added conditional statement to add text run

This commit is contained in:
Dolan Miu
2016-04-21 23:04:15 +01:00
parent 54c09ca4c7
commit c3c49226c7

View File

@ -24,8 +24,10 @@ export class Paragraph extends XmlComponent {
super("w:p"); super("w:p");
this.properties = new ParagraphProperties(); this.properties = new ParagraphProperties();
this.root.push(this.properties); this.root.push(this.properties);
if (text !== undefined) {
this.root.push(new TextRun(text)); this.root.push(new TextRun(text));
} }
}
addText(run: TextRun): Paragraph { addText(run: TextRun): Paragraph {
this.root.push(run); this.root.push(run);