Add Right and Center tab stops
This commit is contained in:
@ -13,7 +13,7 @@ import { PageBreak } from "./page-break";
|
||||
import { ParagraphProperties } from "./properties";
|
||||
import { ISpacingProperties, Spacing } from "./spacing";
|
||||
import { Style } from "./style";
|
||||
import { LeftTabStop, MaxRightTabStop } from "./tab-stop";
|
||||
import { CenterTabStop, LeftTabStop, MaxRightTabStop, RightTabStop } from "./tab-stop";
|
||||
import { NumberProperties } from "./unordered-list";
|
||||
|
||||
export * from "./formatting";
|
||||
@ -117,6 +117,16 @@ export class Paragraph extends XmlComponent {
|
||||
return this;
|
||||
}
|
||||
|
||||
public rightTabStop(position: number): Paragraph {
|
||||
this.properties.push(new RightTabStop(position));
|
||||
return this;
|
||||
}
|
||||
|
||||
public centerTabStop(position: number): Paragraph {
|
||||
this.properties.push(new CenterTabStop(position));
|
||||
return this;
|
||||
}
|
||||
|
||||
public bullet(): Paragraph {
|
||||
this.properties.push(new Style("ListParagraph"));
|
||||
this.properties.push(new NumberProperties(1, 0));
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user