added document attributes
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import {XmlComponent, Attributes} from "../xml-components";
|
||||
import {XmlComponent} from "../xml-components";
|
||||
import {DocumentAttributes} from "../xml-components/document-attributes"
|
||||
import {Body} from "./body";
|
||||
import {Paragraph} from "../paragraph";
|
||||
|
||||
@ -8,7 +9,25 @@ export class Document {
|
||||
|
||||
constructor() {
|
||||
this.document = new Array<XmlComponent>();
|
||||
this.document.push(new Attributes({}));
|
||||
this.document.push(new DocumentAttributes({
|
||||
wpc: 'http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas',
|
||||
mc: 'http://schemas.openxmlformats.org/markup-compatibility/2006',
|
||||
o: 'urn:schemas-microsoft-com:office:office',
|
||||
r: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships',
|
||||
m: 'http://schemas.openxmlformats.org/officeDocument/2006/math',
|
||||
v: 'urn:schemas-microsoft-com:vml',
|
||||
wp14: 'http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing',
|
||||
wp: 'http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing',
|
||||
w10: 'urn:schemas-microsoft-com:office:word',
|
||||
w: 'http://schemas.openxmlformats.org/wordprocessingml/2006/main',
|
||||
w14: 'http://schemas.microsoft.com/office/word/2010/wordml',
|
||||
w15: 'http://schemas.microsoft.com/office/word/2012/wordml',
|
||||
wpg: 'http://schemas.microsoft.com/office/word/2010/wordprocessingGroup',
|
||||
wpi: 'http://schemas.microsoft.com/office/word/2010/wordprocessingInk',
|
||||
wne: 'http://schemas.microsoft.com/office/word/2006/wordml',
|
||||
wps: 'http://schemas.microsoft.com/office/word/2010/wordprocessingShape',
|
||||
Ignorable: 'w14 w15 wp14'
|
||||
}));
|
||||
this.body = new Body();
|
||||
this.document.push(this.body);
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
export {Document} from "./document";
|
||||
export {Paragraph} from "./paragraph";
|
||||
export {Run} from "./run"
|
||||
export {Run} from "./run"
|
||||
export {TextRun} from "./run/text-run"
|
54
ts/docx/xml-components/document-attributes.ts
Normal file
54
ts/docx/xml-components/document-attributes.ts
Normal 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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user