diff --git a/ts/styles/style/index.ts b/ts/styles/style/index.ts index 35e456d937..e70936655b 100644 --- a/ts/styles/style/index.ts +++ b/ts/styles/style/index.ts @@ -161,6 +161,16 @@ export class ParagraphStyle extends Style { return this; } + public maxRightTabStop(): ParagraphStyle { + this.addParagraphProperty(new paragraph.MaxRightTabStop()); + return this; + } + + public leftTabStop(position: number): ParagraphStyle { + this.addParagraphProperty(new paragraph.LeftTabStop(position)); + return this; + } + public indent(left: number, hanging?: number): ParagraphStyle { this.addParagraphProperty(new paragraph.Indent(left, hanging)); return this; diff --git a/ts/tests/stylesTest.ts b/ts/tests/stylesTest.ts index 821ff2a9f3..d00fb4cc0d 100644 --- a/ts/tests/stylesTest.ts +++ b/ts/tests/stylesTest.ts @@ -292,6 +292,40 @@ describe("ParagraphStyle", () => { ], }); }); + + it("#leftTabStop", () => { + const style = new ParagraphStyle("myStyleId") + .leftTabStop(1200); + const tree = new Formatter().format(style); + expect(tree).to.deep.equal({ + "w:style": [ + {_attr: {"w:type": "paragraph", "w:styleId": "myStyleId"}}, + {"w:pPr": [ + {"w:tabs": [ + {"w:tab": [{_attr: {"w:val": "left", "w:pos": 1200}}]}, + ]}, + ]}, + {"w:rPr": []}, + ], + }); + }); + + it("#maxRightTabStop", () => { + const style = new ParagraphStyle("myStyleId") + .maxRightTabStop(); + const tree = new Formatter().format(style); + expect(tree).to.deep.equal({ + "w:style": [ + {_attr: {"w:type": "paragraph", "w:styleId": "myStyleId"}}, + {"w:pPr": [ + {"w:tabs": [ + {"w:tab": [{_attr: {"w:val": "right", "w:pos": 9026}}]}, + ]}, + ]}, + {"w:rPr": []}, + ], + }); + }); }); describe("formatting methods: run properties", () => {