Add Number of pages element

This commit is contained in:
Dolan
2019-01-15 02:09:38 +00:00
parent da0fa86345
commit 8f6984580a
2 changed files with 17 additions and 1 deletions

View File

@ -12,3 +12,11 @@ export class Page extends XmlComponent {
this.root.push("PAGE"); this.root.push("PAGE");
} }
} }
export class NumberOfPages extends XmlComponent {
constructor() {
super("w:instrText");
this.root.push(new TextAttributes({ space: SpaceType.PRESERVE }));
this.root.push("NUMPAGES");
}
}

View File

@ -14,7 +14,7 @@ import {
SizeComplexScript, SizeComplexScript,
Strike, Strike,
} from "./formatting"; } from "./formatting";
import { Page } from "./page-number"; import { NumberOfPages, Page } from "./page-number";
import { RunProperties } from "./properties"; import { RunProperties } from "./properties";
import { RunFonts } from "./run-fonts"; import { RunFonts } from "./run-fonts";
import { SubScript, SuperScript } from "./script"; import { SubScript, SuperScript } from "./script";
@ -84,6 +84,14 @@ export class Run extends XmlComponent {
return this; return this;
} }
public numberOfTotalPages(): Run {
this.root.push(new Begin());
this.root.push(new NumberOfPages());
this.root.push(new Separate());
this.root.push(new End());
return this;
}
public smallCaps(): Run { public smallCaps(): Run {
this.properties.push(new SmallCaps()); this.properties.push(new SmallCaps());
return this; return this;