Add Right and Center tab stops

This commit is contained in:
Dolan
2017-09-19 12:51:37 +01:00
parent 492face7ab
commit da8405b5b9
2 changed files with 26 additions and 4 deletions

View File

@ -8,15 +8,15 @@ export class TabStop extends XmlComponent {
}
}
export type TabOptions = "left" | "right";
export type TabValue = "left" | "right" | "center" | "bar" | "clear" | "decimal" | "end" | "num" | "start";
export class TabAttributes extends XmlAttributeComponent<{val: TabOptions, pos: string | number}> {
export class TabAttributes extends XmlAttributeComponent<{val: TabValue, pos: string | number}> {
protected xmlKeys = {val: "w:val", pos: "w:pos"};
}
export class Tab extends XmlComponent {
constructor(value: TabOptions, position: string | number) {
constructor(value: TabValue, position: string | number) {
super("w:tab");
this.root.push(new TabAttributes({
val: value,
@ -36,3 +36,15 @@ export class LeftTabStop extends TabStop {
super(new Tab("left", position));
}
}
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));
}
}