diff --git a/ts/docx/run/caps.ts b/ts/docx/run/caps.ts new file mode 100644 index 0000000000..0b1e53ef5d --- /dev/null +++ b/ts/docx/run/caps.ts @@ -0,0 +1,15 @@ +import {XmlComponent} from "../xml-components"; + +export class SmallCaps extends XmlComponent { + + constructor() { + super("w:smallCaps"); + } +} + +export class Caps extends XmlComponent { + + constructor() { + super("w:caps"); + } +} diff --git a/ts/docx/run/formatting.ts b/ts/docx/run/formatting.ts index c274e69739..c113aa4188 100644 --- a/ts/docx/run/formatting.ts +++ b/ts/docx/run/formatting.ts @@ -119,15 +119,4 @@ export class Size extends XmlComponent { val: size })); } -} - -// TODO needs work. Add more types of vertical align -export class VerticalAlign extends XmlComponent { - - constructor() { - super("w:vertAlign"); - this.root.push(new Attributes({ - val: "superscript" - })); - } } \ No newline at end of file diff --git a/ts/docx/run/index.ts b/ts/docx/run/index.ts index 127223c978..b0b9b4096f 100644 --- a/ts/docx/run/index.ts +++ b/ts/docx/run/index.ts @@ -3,6 +3,9 @@ import {RunProperties} from "./properties"; import {Bold, Italics, Underline} from "./formatting"; import {Tab} from "./tab"; import {Break} from "./break"; +import {SmallCaps, Caps} from "./caps"; +import {Strike, DoubleStrike} from "./strike"; +import {SubScript, SuperScript} from "./script"; export class Run extends XmlComponent { private properties: RunProperties; @@ -38,4 +41,34 @@ export class Run extends XmlComponent { this.root.splice(1, 0, new Tab()); return this; } + + smallCaps(): Run { + this.properties.push(new SmallCaps()); + return this; + } + + allCaps(): Run { + this.properties.push(new Caps()); + return this; + } + + strike(): Run { + this.properties.push(new Strike()); + return this; + } + + doubleStrike(): Run { + this.properties.push(new DoubleStrike()); + return this; + } + + subScript(): Run { + this.properties.push(new SubScript()); + return this; + } + + superScript(): Run { + this.properties.push(new SuperScript()); + return this; + } } \ No newline at end of file diff --git a/ts/docx/run/properties.ts b/ts/docx/run/properties.ts index 1c65a2ba59..9fc14d1f91 100644 --- a/ts/docx/run/properties.ts +++ b/ts/docx/run/properties.ts @@ -1,4 +1,4 @@ -import {XmlComponent, Attributes} from "../xml-components"; +import {XmlComponent} from "../xml-components"; export class RunProperties extends XmlComponent { diff --git a/ts/docx/run/script.ts b/ts/docx/run/script.ts new file mode 100644 index 0000000000..2dd10da783 --- /dev/null +++ b/ts/docx/run/script.ts @@ -0,0 +1,25 @@ +import {XmlComponent, Attributes} from "../xml-components"; + +abstract class VerticalAlign extends XmlComponent { + + constructor(type: string) { + super("w:vertAlign"); + this.root.push(new Attributes({ + val: "superscript" + })); + } +} + +export class SuperScript extends VerticalAlign { + + constructor() { + super("superscript"); + } +} + +export class SubScript extends VerticalAlign { + + constructor() { + super("subscript"); + } +} \ No newline at end of file diff --git a/ts/docx/run/strike.ts b/ts/docx/run/strike.ts new file mode 100644 index 0000000000..bf19c2293e --- /dev/null +++ b/ts/docx/run/strike.ts @@ -0,0 +1,15 @@ +import {XmlComponent} from "../xml-components"; + +export class Strike extends XmlComponent { + + constructor() { + super("w:strike"); + } +} + +export class DoubleStrike extends XmlComponent { + + constructor() { + super("w:dstrike"); + } +} \ No newline at end of file