From 606e03d1563d645e6ce9a52196a64c8143aea927 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Thu, 19 May 2016 23:06:15 +0100 Subject: [PATCH] added paragraph and run property xml components --- ts/docx/xml-components/index.ts | 63 +++++++++++++++++++++++++++++---- 1 file changed, 56 insertions(+), 7 deletions(-) diff --git a/ts/docx/xml-components/index.ts b/ts/docx/xml-components/index.ts index 38ad807364..10578a0b6b 100644 --- a/ts/docx/xml-components/index.ts +++ b/ts/docx/xml-components/index.ts @@ -124,11 +124,60 @@ export class Attributes extends XmlAttributeComponent { footer: "w:footer", gutter: "w:gutter", linePitch: "w:linePitch" - }); - this.root = properties - - if (!properties) { - this.root = {}; - } + }, properties); } -} \ No newline at end of file +} + +export class ParagraphPropertyXmlComponent extends XmlComponent { + private paragraphProperties: ParagraphProperties; + + constructor(rootKey) { + super(rootKey); + this.paragraphProperties = new ParagraphProperties(); + this.root.push(this.paragraphProperties); + } + + clearVariables(): void { + this.paragraphProperties.clearVariables(); + + delete this.paragraphProperties; + } +} + +export class RunPropertyXmlComponent extends XmlComponent { + private runProperties: RunProperties; + + constructor(rootKey) { + super(rootKey); + this.runProperties = new RunProperties(); + this.root.push(this.runProperties); + } + + clearVariables(): void { + this.runProperties.clearVariables(); + + delete this.runProperties; + } +} + +export class MultiPropertyXmlComponent extends XmlComponent { + private runProperties: RunProperties; + private paragraphProperties: ParagraphProperties; + + constructor(rootKey) { + super(rootKey); + this.runProperties = new RunProperties(); + this.root.push(this.runProperties); + + this.paragraphProperties = new ParagraphProperties(); + this.root.push(this.paragraphProperties); + } + + clearVariables(): void { + this.runProperties.clearVariables(); + this.paragraphProperties.clearVariables(); + + delete this.runProperties; + delete this.paragraphProperties; + } +} \ No newline at end of file