From 1649d2a0fac657084403e8cdb9f422e878f0dba2 Mon Sep 17 00:00:00 2001 From: Max Lay Date: Wed, 11 Dec 2019 15:05:09 +1300 Subject: [PATCH] Allow contextual spacing to be specified as an argument to paragraph style --- src/file/styles/style-options.ts | 1 + src/file/styles/style/paragraph-style.ts | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/file/styles/style-options.ts b/src/file/styles/style-options.ts index dcedadbec5..744f4244fb 100644 --- a/src/file/styles/style-options.ts +++ b/src/file/styles/style-options.ts @@ -29,6 +29,7 @@ export interface IRunStyleOptions { export interface IParagraphStyleOptions2 { readonly alignment?: AlignmentType; readonly thematicBreak?: boolean; + readonly contextualSpacing?: boolean; readonly rightTabStop?: number; readonly leftTabStop?: number; readonly indent?: IIndentAttributesProperties; diff --git a/src/file/styles/style/paragraph-style.ts b/src/file/styles/style/paragraph-style.ts index a47a33f492..4f7111625c 100644 --- a/src/file/styles/style/paragraph-style.ts +++ b/src/file/styles/style/paragraph-style.ts @@ -1,4 +1,4 @@ -import { Alignment, Indent, KeepLines, KeepNext, OutlineLevel, ParagraphProperties, Spacing, ThematicBreak } from "file/paragraph"; +import { Alignment, ContextualSpacing, Indent, KeepLines, KeepNext, OutlineLevel, ParagraphProperties, Spacing, ThematicBreak } from "file/paragraph"; import { TabStop, TabStopType } from "file/paragraph/formatting"; import * as formatting from "file/paragraph/run/formatting"; import { RunProperties } from "file/paragraph/run/properties"; @@ -134,6 +134,10 @@ export class ParagraphStyle extends Style { this.paragraphProperties.push(new ThematicBreak()); } + if (options.paragraph.contextualSpacing) { + this.paragraphProperties.push(new ContextualSpacing(options.paragraph.contextualSpacing)); + } + if (options.paragraph.rightTabStop) { this.paragraphProperties.push(new TabStop(TabStopType.RIGHT, options.paragraph.rightTabStop)); }