2017-09-19 15:17:58 +01:00
|
|
|
// http://officeopenxml.com/WPtab.php
|
2017-12-30 20:25:16 +00:00
|
|
|
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
2016-05-18 17:06:21 +01:00
|
|
|
|
2017-07-07 14:31:08 +01:00
|
|
|
export class TabStop extends XmlComponent {
|
2016-05-18 17:06:21 +01:00
|
|
|
|
|
|
|
constructor(tab: Tab) {
|
|
|
|
super("w:tabs");
|
|
|
|
this.root.push(tab);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-09-19 12:51:37 +01:00
|
|
|
export type TabValue = "left" | "right" | "center" | "bar" | "clear" | "decimal" | "end" | "num" | "start";
|
2017-03-12 22:06:11 +01:00
|
|
|
|
2017-09-19 12:51:37 +01:00
|
|
|
export class TabAttributes extends XmlAttributeComponent<{val: TabValue, pos: string | number}> {
|
2017-03-12 22:06:11 +01:00
|
|
|
protected xmlKeys = {val: "w:val", pos: "w:pos"};
|
|
|
|
}
|
|
|
|
|
2017-07-07 14:31:08 +01:00
|
|
|
export class Tab extends XmlComponent {
|
2016-05-18 17:06:21 +01:00
|
|
|
|
2017-09-19 12:51:37 +01:00
|
|
|
constructor(value: TabValue, position: string | number) {
|
2016-05-18 17:06:21 +01:00
|
|
|
super("w:tab");
|
2017-03-12 22:06:11 +01:00
|
|
|
this.root.push(new TabAttributes({
|
2016-05-18 17:06:21 +01:00
|
|
|
val: value,
|
2017-03-08 21:40:21 +00:00
|
|
|
pos: position,
|
2016-05-18 17:06:21 +01:00
|
|
|
}));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export class MaxRightTabStop extends TabStop {
|
|
|
|
constructor() {
|
2016-06-10 15:03:44 +01:00
|
|
|
super(new Tab("right", 9026));
|
2016-05-18 17:06:21 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export class LeftTabStop extends TabStop {
|
|
|
|
constructor(position: number) {
|
|
|
|
super(new Tab("left", position));
|
|
|
|
}
|
|
|
|
}
|
2017-09-19 12:51:37 +01:00
|
|
|
|
|
|
|
export class RightTabStop extends TabStop {
|
|
|
|
constructor(position: number) {
|
|
|
|
super(new Tab("right", position));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export class CenterTabStop extends TabStop {
|
|
|
|
constructor(position: number) {
|
|
|
|
super(new Tab("center", position));
|
|
|
|
}
|
|
|
|
}
|