diff --git a/src/export/packer/compiler.ts b/src/export/packer/compiler.ts index d99ef1955a..6ee1665074 100644 --- a/src/export/packer/compiler.ts +++ b/src/export/packer/compiler.ts @@ -68,7 +68,7 @@ export class Compiler { this.archive.append(xmlHeader2, { name: "word/header2.xml", }); - + this.archive.append(xmlFooter, { name: "word/footer1.xml", }); diff --git a/src/file/content-types/content-types.ts b/src/file/content-types/content-types.ts index 64c9db3113..9bb3837cb2 100644 --- a/src/file/content-types/content-types.ts +++ b/src/file/content-types/content-types.ts @@ -24,7 +24,7 @@ export class ContentTypes extends XmlComponent { this.root.push( new Override("application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml", "/word/document.xml"), ); - + this.root.push(new Override("application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml", "/word/header1.xml")); this.root.push(new Override("application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml", "/word/header2.xml")); this.root.push(new Override("application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml", "/word/footer1.xml")); diff --git a/src/file/document/body/section-properties/header-reference/header-reference.ts b/src/file/document/body/section-properties/header-reference/header-reference.ts index 53d75ede28..cd9d8e7349 100644 --- a/src/file/document/body/section-properties/header-reference/header-reference.ts +++ b/src/file/document/body/section-properties/header-reference/header-reference.ts @@ -2,12 +2,12 @@ import { XmlComponent } from "file/xml-components"; import { HeaderReferenceAttributes } from "./header-reference-attributes"; export class HeaderReference extends XmlComponent { - constructor(order, ref_id) { + constructor(order: string, refID: number) { super("w:headerReference"); this.root.push( new HeaderReferenceAttributes({ type: order, - id: `rId${ref_id}`, + id: `rId${refID}`, }), ); } diff --git a/src/file/document/body/section-properties/section-properties.ts b/src/file/document/body/section-properties/section-properties.ts index aea95a0d85..4cd6e35656 100644 --- a/src/file/document/body/section-properties/section-properties.ts +++ b/src/file/document/body/section-properties/section-properties.ts @@ -53,13 +53,13 @@ export class SectionProperties extends XmlComponent { ); this.root.push(new Columns(mergedOptions.space)); this.root.push(new DocumentGrid(mergedOptions.linePitch)); - this.root.push(new HeaderReference("default",3)); - + this.root.push(new HeaderReference("default", 3)); + if (mergedOptions.differentFirstPageHeader) { - this.root.push(new HeaderReference("first",5)); + this.root.push(new HeaderReference("first", 5)); this.root.push(new TitlePage()); } - + this.root.push(new FooterReference()); } } diff --git a/src/file/document/body/section-properties/title-page/title-page-attributes.ts b/src/file/document/body/section-properties/title-page/title-page-attributes.ts index 960064ec1f..9022cccf3d 100644 --- a/src/file/document/body/section-properties/title-page/title-page-attributes.ts +++ b/src/file/document/body/section-properties/title-page/title-page-attributes.ts @@ -8,4 +8,4 @@ export class TitlePageAttributes extends XmlAttributeComponent { +class FidCharAttrs extends XmlAttributeComponent<{ type: "begin" | "end" | "separate" }> { protected xmlKeys = { type: "w:fldCharType" }; } @@ -11,7 +11,7 @@ class TextAttributes extends XmlAttributeComponent<{ space: "default" | "preserv export class Begin extends XmlComponent { constructor() { super("w:fldChar"); - this.root.push(new fidCharAttrs({ type: "begin" })); + this.root.push(new FidCharAttrs({ type: "begin" })); } } @@ -26,13 +26,13 @@ export class Page extends XmlComponent { export class Separate extends XmlComponent { constructor() { super("w:fldChar"); - this.root.push(new fidCharAttrs({ type: "separate" })); + this.root.push(new FidCharAttrs({ type: "separate" })); } } export class End extends XmlComponent { constructor() { super("w:fldChar"); - this.root.push(new fidCharAttrs({ type: "end" })); + this.root.push(new FidCharAttrs({ type: "end" })); } -} \ No newline at end of file +} diff --git a/src/file/paragraph/run/run.ts b/src/file/paragraph/run/run.ts index 3123f98cd2..b913e49df4 100644 --- a/src/file/paragraph/run/run.ts +++ b/src/file/paragraph/run/run.ts @@ -2,13 +2,13 @@ import { Break } from "./break"; import { Caps, SmallCaps } from "./caps"; import { Bold, Color, DoubleStrike, Italics, Size, Strike } from "./formatting"; +import { Begin, End, Page, Separate } from "./page-number"; import { RunProperties } from "./properties"; import { RunFonts } from "./run-fonts"; import { SubScript, SuperScript } from "./script"; import { Style } from "./style"; import { Tab } from "./tab"; import { Underline } from "./underline"; -import { Begin, Page, End, Separate } from "./page-number"; import { XmlComponent } from "file/xml-components";