added emphasis to run
This commit is contained in:
34
ts/docx/run/emphasis.ts
Normal file
34
ts/docx/run/emphasis.ts
Normal 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
|
||||
}));
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -6,4 +6,8 @@ export class RunProperties {
|
||||
constructor() {
|
||||
this.rPr = new Array<XmlComponent>();
|
||||
}
|
||||
|
||||
push(item: XmlComponent) {
|
||||
this.rPr.push(item);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user