Files
docx-js/src/file/paragraph/formatting/alignment.ts

25 lines
658 B
TypeScript
Raw Normal View History

2017-09-22 14:46:19 +01:00
// http://officeopenxml.com/WPalignment.php
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
2019-06-12 01:03:36 +01:00
export enum AlignmentType {
START = "start",
END = "end",
CENTER = "center",
BOTH = "both",
2019-06-12 01:03:36 +01:00
JUSTIFIED = "both",
DISTRIBUTE = "distribute",
LEFT = "left",
RIGHT = "right",
}
2019-06-12 01:03:36 +01:00
export class AlignmentAttributes extends XmlAttributeComponent<{ readonly val: AlignmentType }> {
protected readonly xmlKeys = { val: "w:val" };
}
export class Alignment extends XmlComponent {
2019-06-12 01:03:36 +01:00
constructor(type: AlignmentType) {
super("w:jc");
2018-01-23 01:33:12 +00:00
this.root.push(new AlignmentAttributes({ val: type }));
}
}