Created classes and methods needed to create Sequential Identifiers

This commit is contained in:
Sergio Mendonça
2018-10-19 16:50:51 -03:00
parent a466578467
commit 23dee01f06
6 changed files with 121 additions and 1 deletions

View File

@ -0,0 +1,19 @@
// http://officeopenxml.com/WPfieldInstructions.php
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
enum SpaceType {
DEFAULT = "default",
PRESERVE = "preserve",
}
class TextAttributes extends XmlAttributeComponent<{ space: SpaceType }> {
protected xmlKeys = { space: "xml:space" };
}
export class SequentialIdentifierInstruction extends XmlComponent {
constructor(identifier: string) {
super("w:instrText");
this.root.push(new TextAttributes({ space: SpaceType.PRESERVE }));
this.root.push(`SEQ ${identifier}`);
}
}