added document attributes

This commit is contained in:
Dolan Miu
2016-04-03 05:23:13 +01:00
parent 69edfcc0c9
commit 213696b780
6 changed files with 155 additions and 17 deletions

View File

@ -0,0 +1,54 @@
import {XmlComponent} from "./";
interface DocumentAttributesProperties {
wpc?: string;
mc?: string;
o?: string;
r?: string;
m?: string;
v?: string;
wp14?: string;
wp?: string;
w10?: string;
w?: string;
w14?: string;
w15?: string;
wpg?: string;
wpi?: string;
wne?: string;
wps?: string;
Ignorable?: string;
}
export class DocumentAttributes implements XmlComponent {
private _attrs: Object;
xmlKeys = {
wpc: 'xmlns:wpc',
mc: 'xmlns:mc',
o: 'xmlns:o',
r: 'xmlns:r',
m: 'xmlns:m',
v: 'xmlns:v',
wp14: 'xmlns:wp14',
wp: 'xmlns:wp',
w10: 'xmlns:w10',
w: 'xmlns:w',
w14: 'xmlns:w14',
w15: 'xmlns:w15',
wpg: 'xmlns:wpg',
wpi: 'xmlns:wpi',
wne: 'xmlns:wne',
wps: 'xmlns:wps',
Ignorable: 'mc:Ignorable'
};
constructor(properties?: DocumentAttributesProperties) {
this._attrs = properties
if (!properties) {
this._attrs = {};
}
this._attrs["xmlKeys"] = this.xmlKeys;
}
}

View File

@ -13,20 +13,39 @@ interface AttributesProperties {
rsidSect?: string;
w?: string;
h?: string;
top?: string,
right?: string,
bottom?: string,
left?: string,
header?: string,
footer?: string,
gutter?: string,
linePitch?: string
top?: string;
right?: string;
bottom?: string;
left?: string;
header?: string;
footer?: string;
gutter?: string;
linePitch?: string;
}
export class Attributes implements XmlComponent {
private _attrs: Object;
xmlKeys = {};
xmlKeys = {
val: "w:val",
color: "w:color",
space: "w:space",
sz: "w:sz",
type: "w:type",
rsidR: "w:rsidR",
rsidRPr: "w:rsidRPr",
rsidSect: "w:rsidSect",
w: "w:w",
h: "w:h",
top: "w:top",
right: "w:right",
bottom: "w:bottom",
left: "w:left",
header: "w:header",
footer: "w:footer",
gutter: "w:gutter",
linePitch: "w:linePitch"
};
constructor(properties?: AttributesProperties) {
this._attrs = properties
@ -34,6 +53,8 @@ export class Attributes implements XmlComponent {
if (!properties) {
this._attrs = {};
}
this._attrs["xmlKeys"] = this.xmlKeys;
}
}