/
section-type.ts
40 lines (36 loc) · 1.23 KB
/
section-type.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// http://officeopenxml.com/WPsection.php
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
// <xsd:simpleType name="ST_SectionMark">
// <xsd:restriction base="xsd:string">
// <xsd:enumeration value="nextPage"/>
// <xsd:enumeration value="nextColumn"/>
// <xsd:enumeration value="continuous"/>
// <xsd:enumeration value="evenPage"/>
// <xsd:enumeration value="oddPage"/>
// </xsd:restriction>
// </xsd:simpleType>
/* eslint-disable @typescript-eslint/naming-convention */
export const SectionType = {
NEXT_PAGE: "nextPage",
NEXT_COLUMN: "nextColumn",
CONTINUOUS: "continuous",
EVEN_PAGE: "evenPage",
ODD_PAGE: "oddPage",
} as const;
/* eslint-enable */
// <xsd:complexType name="CT_SectType">
// <xsd:attribute name="val" type="ST_SectionMark"/>
// </xsd:complexType>
export class SectionTypeAttributes extends XmlAttributeComponent<{
readonly val: (typeof SectionType)[keyof typeof SectionType];
}> {
protected readonly xmlKeys = {
val: "w:val",
};
}
export class Type extends XmlComponent {
public constructor(value: (typeof SectionType)[keyof typeof SectionType]) {
super("w:type");
this.root.push(new SectionTypeAttributes({ val: value }));
}
}