Created classes and methods needed to create Sequential Identifiers
This commit is contained in:
19
src/file/paragraph/run/sequential-identifier-instruction.ts
Normal file
19
src/file/paragraph/run/sequential-identifier-instruction.ts
Normal 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}`);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user