/
vertical-align.ts
33 lines (29 loc) · 1.02 KB
/
vertical-align.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
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
// <xsd:complexType name="CT_VerticalJc">
// <xsd:attribute name="val" type="ST_VerticalJc" use="required"/>
// </xsd:complexType>
// <xsd:simpleType name="ST_VerticalJc">
// <xsd:restriction base="xsd:string">
// <xsd:enumeration value="top"/>
// <xsd:enumeration value="center"/>
// <xsd:enumeration value="bottom"/>
// </xsd:restriction>
// </xsd:simpleType>
export const VerticalAlign = {
BOTTOM: "bottom",
CENTER: "center",
TOP: "top",
} as const;
export class VerticalAlignAttributes extends XmlAttributeComponent<{
readonly verticalAlign?: (typeof VerticalAlign)[keyof typeof VerticalAlign];
}> {
protected readonly xmlKeys = {
verticalAlign: "w:val",
};
}
export class VerticalAlignElement extends XmlComponent {
public constructor(value: (typeof VerticalAlign)[keyof typeof VerticalAlign]) {
super("w:vAlign");
this.root.push(new VerticalAlignAttributes({ verticalAlign: value }));
}
}