From c3c49226c77e5bc9b0a9a14ab36bd712bfa9f843 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Thu, 21 Apr 2016 23:04:15 +0100 Subject: [PATCH] added conditional statement to add text run --- ts/docx/paragraph/index.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ts/docx/paragraph/index.ts b/ts/docx/paragraph/index.ts index b811d9f2d3..afb9b0fdaa 100644 --- a/ts/docx/paragraph/index.ts +++ b/ts/docx/paragraph/index.ts @@ -19,12 +19,14 @@ class Alignment extends XmlComponent { export class Paragraph extends XmlComponent { private properties: ParagraphProperties; - + constructor(text?: string) { super("w:p"); this.properties = new ParagraphProperties(); this.root.push(this.properties); - this.root.push(new TextRun(text)); + if (text !== undefined) { + this.root.push(new TextRun(text)); + } } addText(run: TextRun): Paragraph {