added border

This commit is contained in:
Dolan Miu
2016-03-29 04:50:23 +01:00
parent 672cbb6922
commit e2929bc3a9
6 changed files with 92 additions and 10 deletions

24
ts/docx/border.ts Normal file
View File

@ -0,0 +1,24 @@
import {P, Attributes} from "./xml-components";
class Border implements P {
private bottom: Array<P>;
constructor() {
this.bottom = new Array<P>();
this.bottom.push(new Attributes({
color: "auto",
space: "1",
val: "single",
sz: "6"
}));
}
}
export class ThematicBreak {
private pBdr: Array<P>;
constructor() {
this.pBdr = new Array<P>();
this.pBdr.push(new Border());
}
}

View File

@ -5,7 +5,9 @@ class Style {
constructor(type: string) {
this.pStyle = new Array<P>();
this.pStyle.push(new Attributes(type));
this.pStyle.push(new Attributes({
val: type
}));
}
}
@ -14,7 +16,9 @@ class Alignment {
constructor(type: string) {
this.jc = new Array<P>();
this.jc.push(new Attributes(type));
this.jc.push(new Attributes({
val: type
}));
}
}

View File

@ -2,24 +2,33 @@ export interface P {
}
interface AttributesProperties {
val?: string;
color?: string;
space?: string;
sz?: string;
}
export class Attributes implements P {
private _attrs: Object;
constructor(value?: string) {
this._attrs = {
val: value
};
constructor(properties?: AttributesProperties) {
this._attrs = properties
if (!properties) {
this._attrs = {};
}
}
}
export class ParagraphProperties implements P{
export class ParagraphProperties implements P {
private pPr: Array<P>;
constructor() {
this.pPr = new Array<P>();
this.pPr.push(new Attributes());
}
push(item: P) {
this.pPr.push(item);
}