diff --git a/ts/styles/style/index.ts b/ts/styles/style/index.ts index 6b9b64fdd9..af37157bd9 100644 --- a/ts/styles/style/index.ts +++ b/ts/styles/style/index.ts @@ -101,6 +101,16 @@ export class ParagraphStyle extends Style { return this; } + public strike(): ParagraphStyle { + this.addRunProperty(new formatting.Strike()); + return this; + } + + public doubleStrike(): ParagraphStyle { + this.addRunProperty(new formatting.DoubleStrike()); + return this; + } + public underline(underlineType?: string, color?: string): ParagraphStyle { this.addRunProperty(new formatting.Underline(underlineType, color)); return this; diff --git a/ts/tests/stylesTest.ts b/ts/tests/stylesTest.ts index 03214ec701..c7a87f6b40 100644 --- a/ts/tests/stylesTest.ts +++ b/ts/tests/stylesTest.ts @@ -260,6 +260,36 @@ describe("ParagraphStyle", () => { }); }); + it("#strike", () => { + const style = new ParagraphStyle("myStyleId") + .strike(); + const tree = new Formatter().format(style); + expect(tree).to.deep.equal({ + "w:style": [ + {_attr: {"w:type": "paragraph", "w:styleId": "myStyleId"}}, + {"w:pPr": []}, + {"w:rPr": [ + {"w:strike": [{_attr: {"w:val": true}}]}, + ]}, + ], + }); + }); + + it("#doubleStrike", () => { + const style = new ParagraphStyle("myStyleId") + .doubleStrike(); + const tree = new Formatter().format(style); + expect(tree).to.deep.equal({ + "w:style": [ + {_attr: {"w:type": "paragraph", "w:styleId": "myStyleId"}}, + {"w:pPr": []}, + {"w:rPr": [ + {"w:dstrike": [{_attr: {"w:val": true}}]}, + ]}, + ], + }); + }); + it("#bold", () => { const style = new ParagraphStyle("myStyleId") .bold();