added emphasis to run

This commit is contained in:
Dolan Miu
2016-03-30 04:30:58 +01:00
parent b81c3875a3
commit f7803b3156
3 changed files with 43 additions and 1 deletions

34
ts/docx/run/emphasis.ts Normal file
View File

@ -0,0 +1,34 @@
import {XmlComponent, Attributes} from "../xml-components";
export class Bold {
private b: Array<XmlComponent>;
constructor() {
this.b = new Array<XmlComponent>();
this.b.push(new Attributes({
val: true
}));
}
}
export class Italics {
private i: Array<XmlComponent>;
constructor() {
this.i = new Array<XmlComponent>();
this.i.push(new Attributes({
val: true
}));
}
}
export class Underline {
private u: Array<XmlComponent>;
constructor() {
this.u = new Array<XmlComponent>();
this.u.push(new Attributes({
val: true
}));
}
}

View File

@ -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<XmlComponent>;
@ -11,5 +12,8 @@ export class Run implements XmlComponent {
this.r.push(this.properties);
}
bold(): Run {
this.properties.push(new Bold());
return this;
}
}

View File

@ -6,4 +6,8 @@ export class RunProperties {
constructor() {
this.rPr = new Array<XmlComponent>();
}
push(item: XmlComponent) {
this.rPr.push(item);
}
}