Files
docx-js/ts/docx/xml-components/index.ts

53 lines
1.0 KiB
TypeScript
Raw Normal View History

2016-03-29 22:55:37 +01:00
export interface XmlComponent {
2016-03-28 03:55:33 +01:00
}
2016-03-29 04:50:23 +01:00
interface AttributesProperties {
val?: string;
color?: string;
space?: string;
sz?: string;
}
2016-03-29 22:55:37 +01:00
export class Attributes implements XmlComponent {
2016-03-28 03:55:33 +01:00
private _attrs: Object;
2016-03-29 04:50:23 +01:00
constructor(properties?: AttributesProperties) {
this._attrs = properties
2016-03-29 22:55:37 +01:00
2016-03-29 04:50:23 +01:00
if (!properties) {
this._attrs = {};
}
2016-03-28 03:55:33 +01:00
}
}
2016-03-29 22:55:37 +01:00
export class ParagraphProperties implements XmlComponent {
private pPr: Array<XmlComponent>;
2016-03-28 03:55:33 +01:00
constructor() {
2016-03-29 22:55:37 +01:00
this.pPr = new Array<XmlComponent>();
2016-03-28 03:55:33 +01:00
this.pPr.push(new Attributes());
}
2016-03-29 04:50:23 +01:00
2016-03-29 22:55:37 +01:00
push(item: XmlComponent) {
2016-03-29 04:10:33 +01:00
this.pPr.push(item);
}
2016-03-28 03:55:33 +01:00
}
2016-03-29 22:55:37 +01:00
export class Run implements XmlComponent {
private r: Array<XmlComponent>;
2016-03-28 03:55:33 +01:00
constructor(text: string) {
2016-03-29 22:55:37 +01:00
this.r = new Array<XmlComponent>();
2016-03-29 04:10:33 +01:00
this.r.push(new ParagraphProperties());
2016-03-28 03:55:33 +01:00
this.r.push(new Text(text));
}
}
2016-03-29 22:55:37 +01:00
export class Text implements XmlComponent {
2016-03-28 03:55:33 +01:00
private t: string;
constructor(text: string) {
this.t = text;
}
}