diff --git a/src/file/styles/style/paragraph-style.spec.ts b/src/file/styles/style/paragraph-style.spec.ts index 0fb854ce22..96ba8921bf 100644 --- a/src/file/styles/style/paragraph-style.spec.ts +++ b/src/file/styles/style/paragraph-style.spec.ts @@ -258,6 +258,18 @@ describe("ParagraphStyle", () => { ], }); }); + + it("#outlineLevel", () => { + const style = new ParagraphStyle("myStyleId").outlineLevel("1"); + const tree = new Formatter().format(style); + expect(tree).to.deep.equal({ + "w:style": [ + { _attr: { "w:type": "paragraph", "w:styleId": "myStyleId" } }, + { "w:pPr": [{ "w:outlineLvl": [{ _attr: { "w:val": "1" } }] }] }, + { "w:rPr": [] }, + ], + }); + }); }); describe("formatting methods: run properties", () => { diff --git a/src/file/styles/style/paragraph-style.ts b/src/file/styles/style/paragraph-style.ts index 60f0035529..d231c58f33 100644 --- a/src/file/styles/style/paragraph-style.ts +++ b/src/file/styles/style/paragraph-style.ts @@ -7,6 +7,7 @@ import { KeepNext, LeftTabStop, MaxRightTabStop, + OutlineLevel, ParagraphProperties, Spacing, ThematicBreak, @@ -34,6 +35,11 @@ export class ParagraphStyle extends Style { return this; } + public outlineLevel(level: string): ParagraphStyle { + this.paragraphProperties.push(new OutlineLevel(level)); + return this; + } + public addRunProperty(property: XmlComponent): ParagraphStyle { this.runProperties.push(property); return this;