Files
docx-js/src/file/paragraph/run/page-number.ts

38 lines
1.0 KiB
TypeScript
Raw Normal View History

2018-05-12 20:04:54 -04:00
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
class fidCharAttrs extends XmlAttributeComponent<{ type: "begin" | "end" | "separate" }> {
protected xmlKeys = { type: "w:fldCharType" };
}
class TextAttributes extends XmlAttributeComponent<{ space: "default" | "preserve" }> {
protected xmlKeys = { space: "xml:space" };
}
export class Begin extends XmlComponent {
constructor() {
super("w:fldChar");
this.root.push(new fidCharAttrs({ type: "begin" }));
}
}
export class Page extends XmlComponent {
constructor() {
super("w:instrText");
this.root.push(new TextAttributes({ space: "preserve" }));
this.root.push("PAGE");
}
}
export class Separate extends XmlComponent {
constructor() {
super("w:fldChar");
this.root.push(new fidCharAttrs({ type: "separate" }));
}
}
export class End extends XmlComponent {
constructor() {
super("w:fldChar");
this.root.push(new fidCharAttrs({ type: "end" }));
}
}