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>
|
2019-06-12 01:03:36 +01:00
|
|
|
export enum AlignmentType {
|
2022-11-19 20:14:15 +00:00
|
|
|
/** Align Start */
|
2018-11-02 02:51:57 +00:00
|
|
|
START = "start",
|
2022-11-19 20:14:15 +00:00
|
|
|
/** Align Center */
|
2018-11-02 02:51:57 +00:00
|
|
|
CENTER = "center",
|
2022-11-19 20:14:15 +00:00
|
|
|
/** End */
|
|
|
|
END = "end",
|
|
|
|
/** Justified */
|
2018-11-02 02:51:57 +00:00
|
|
|
BOTH = "both",
|
2022-11-19 20:14:15 +00:00
|
|
|
/** Medium Kashida Length */
|
|
|
|
MEDIUM_KASHIDA = "mediumKashida",
|
|
|
|
/** Distribute All Characters Equally */
|
2018-11-02 02:51:57 +00:00
|
|
|
DISTRIBUTE = "distribute",
|
2022-11-19 20:14:15 +00:00
|
|
|
/** Align to List Tab */
|
|
|
|
NUM_TAB = "numTab",
|
|
|
|
/** Widest Kashida Length */
|
|
|
|
HIGH_KASHIDA = "highKashida",
|
|
|
|
/** Low Kashida Length */
|
|
|
|
LOW_KASHIDA = "lowKashida",
|
|
|
|
/** Thai Language Justification */
|
|
|
|
THAI_DISTRIBUTE = "thaiDistribute",
|
|
|
|
/** Align Left */
|
2018-11-02 02:51:57 +00:00
|
|
|
LEFT = "left",
|
2022-11-19 20:14:15 +00:00
|
|
|
/** Align Right */
|
2018-11-02 02:51:57 +00:00
|
|
|
RIGHT = "right",
|
2022-11-19 20:14:15 +00:00
|
|
|
/** Justified */
|
|
|
|
JUSTIFIED = "both",
|
2018-11-02 02:51:57 +00:00
|
|
|
}
|
2017-03-12 21:35:30 +01:00
|
|
|
|
2019-06-12 01:03:36 +01:00
|
|
|
export class AlignmentAttributes extends XmlAttributeComponent<{ readonly val: 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 {
|
2022-08-31 07:52:27 +01:00
|
|
|
public constructor(type: 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
|
|
|
}
|
|
|
|
}
|