2017-09-22 14:46:19 +01:00
|
|
|
// http://officeopenxml.com/WPalignment.php
|
2019-11-24 03:22:50 +00:00
|
|
|
// http://officeopenxml.com/WPtableAlignment.php
|
2022-11-19 20:14:15 +00:00
|
|
|
// http://www.datypic.com/sc/ooxml/t-w_ST_Jc.html
|
2022-06-26 23:26:42 +01:00
|
|
|
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
|
2017-03-12 21:35:30 +01:00
|
|
|
|
2022-11-19 20:14:15 +00:00
|
|
|
// <xsd:simpleType name="ST_Jc">
|
|
|
|
// <xsd:restriction base="xsd:string">
|
|
|
|
// <xsd:enumeration value="start"/>
|
|
|
|
// <xsd:enumeration value="center"/>
|
|
|
|
// <xsd:enumeration value="end"/>
|
|
|
|
// <xsd:enumeration value="both"/>
|
|
|
|
// <xsd:enumeration value="mediumKashida"/>
|
|
|
|
// <xsd:enumeration value="distribute"/>
|
|
|
|
// <xsd:enumeration value="numTab"/>
|
|
|
|
// <xsd:enumeration value="highKashida"/>
|
|
|
|
// <xsd:enumeration value="lowKashida"/>
|
|
|
|
// <xsd:enumeration value="thaiDistribute"/>
|
|
|
|
// <xsd:enumeration value="left"/>
|
|
|
|
// <xsd:enumeration value="right"/>
|
|
|
|
// </xsd:restriction>
|
|
|
|
// </xsd:simpleType>
|
2023-12-22 10:25:00 +09:00
|
|
|
|
|
|
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
|
|
export const AlignmentType = {
|
2022-11-19 20:14:15 +00:00
|
|
|
/** Align Start */
|
2023-12-22 10:25:00 +09:00
|
|
|
START: "start",
|
2022-11-19 20:14:15 +00:00
|
|
|
/** Align Center */
|
2023-12-22 10:25:00 +09:00
|
|
|
CENTER: "center",
|
2022-11-19 20:14:15 +00:00
|
|
|
/** End */
|
2023-12-22 10:25:00 +09:00
|
|
|
END: "end",
|
2022-11-19 20:14:15 +00:00
|
|
|
/** Justified */
|
2023-12-22 10:25:00 +09:00
|
|
|
BOTH: "both",
|
2022-11-19 20:14:15 +00:00
|
|
|
/** Medium Kashida Length */
|
2023-12-22 10:25:00 +09:00
|
|
|
MEDIUM_KASHIDA: "mediumKashida",
|
2022-11-19 20:14:15 +00:00
|
|
|
/** Distribute All Characters Equally */
|
2023-12-22 10:25:00 +09:00
|
|
|
DISTRIBUTE: "distribute",
|
2022-11-19 20:14:15 +00:00
|
|
|
/** Align to List Tab */
|
2023-12-22 10:25:00 +09:00
|
|
|
NUM_TAB: "numTab",
|
2022-11-19 20:14:15 +00:00
|
|
|
/** Widest Kashida Length */
|
2023-12-22 10:25:00 +09:00
|
|
|
HIGH_KASHIDA: "highKashida",
|
2022-11-19 20:14:15 +00:00
|
|
|
/** Low Kashida Length */
|
2023-12-22 10:25:00 +09:00
|
|
|
LOW_KASHIDA: "lowKashida",
|
2022-11-19 20:14:15 +00:00
|
|
|
/** Thai Language Justification */
|
2023-12-22 10:25:00 +09:00
|
|
|
THAI_DISTRIBUTE: "thaiDistribute",
|
2022-11-19 20:14:15 +00:00
|
|
|
/** Align Left */
|
2023-12-22 10:25:00 +09:00
|
|
|
LEFT: "left",
|
2022-11-19 20:14:15 +00:00
|
|
|
/** Align Right */
|
2023-12-22 10:25:00 +09:00
|
|
|
RIGHT: "right",
|
2022-11-19 20:14:15 +00:00
|
|
|
/** Justified */
|
2023-12-22 10:25:00 +09:00
|
|
|
JUSTIFIED: "both",
|
|
|
|
} as const;
|
|
|
|
|
|
|
|
/* eslint-enable */
|
2017-03-12 21:35:30 +01:00
|
|
|
|
2023-12-22 10:25:00 +09:00
|
|
|
export class AlignmentAttributes extends XmlAttributeComponent<{
|
|
|
|
readonly val: (typeof AlignmentType)[keyof typeof AlignmentType];
|
|
|
|
}> {
|
2018-11-02 02:51:57 +00:00
|
|
|
protected readonly xmlKeys = { val: "w:val" };
|
2017-03-12 21:35:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export class Alignment extends XmlComponent {
|
2023-12-22 10:25:00 +09:00
|
|
|
public constructor(type: (typeof AlignmentType)[keyof typeof AlignmentType]) {
|
2017-03-12 21:35:30 +01:00
|
|
|
super("w:jc");
|
2018-01-23 01:33:12 +00:00
|
|
|
this.root.push(new AlignmentAttributes({ val: type }));
|
2017-03-12 21:35:30 +01:00
|
|
|
}
|
|
|
|
}
|