From f7803b315657a3174783595b4d0289eed4e16009 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Wed, 30 Mar 2016 04:30:58 +0100 Subject: [PATCH] added emphasis to run --- ts/docx/run/emphasis.ts | 34 ++++++++++++++++++++++++++++++++++ ts/docx/run/index.ts | 6 +++++- ts/docx/run/properties.ts | 4 ++++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 ts/docx/run/emphasis.ts diff --git a/ts/docx/run/emphasis.ts b/ts/docx/run/emphasis.ts new file mode 100644 index 0000000000..540777c5eb --- /dev/null +++ b/ts/docx/run/emphasis.ts @@ -0,0 +1,34 @@ +import {XmlComponent, Attributes} from "../xml-components"; + +export class Bold { + private b: Array; + + constructor() { + this.b = new Array(); + this.b.push(new Attributes({ + val: true + })); + } +} + +export class Italics { + private i: Array; + + constructor() { + this.i = new Array(); + this.i.push(new Attributes({ + val: true + })); + } +} + +export class Underline { + private u: Array; + + constructor() { + this.u = new Array(); + this.u.push(new Attributes({ + val: true + })); + } +} \ No newline at end of file diff --git a/ts/docx/run/index.ts b/ts/docx/run/index.ts index 8d33527488..12f550dd67 100644 --- a/ts/docx/run/index.ts +++ b/ts/docx/run/index.ts @@ -1,5 +1,6 @@ import {XmlComponent, Attributes} from "../xml-components"; import {RunProperties} from "./properties"; +import {Bold} from "./emphasis"; export class Run implements XmlComponent { protected r: Array; @@ -11,5 +12,8 @@ export class Run implements XmlComponent { this.r.push(this.properties); } - + bold(): Run { + this.properties.push(new Bold()); + return this; + } } \ No newline at end of file diff --git a/ts/docx/run/properties.ts b/ts/docx/run/properties.ts index 30e9631da8..8b22e796e2 100644 --- a/ts/docx/run/properties.ts +++ b/ts/docx/run/properties.ts @@ -6,4 +6,8 @@ export class RunProperties { constructor() { this.rPr = new Array(); } + + push(item: XmlComponent) { + this.rPr.push(item); + } }