added body
This commit is contained in:
@ -1,3 +0,0 @@
|
|||||||
export class Body {
|
|
||||||
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
export class Document {
|
|
||||||
private body: string;
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
this.body = "ggg";
|
|
||||||
}
|
|
||||||
|
|
||||||
test() {
|
|
||||||
return "hello";
|
|
||||||
}
|
|
||||||
}
|
|
12
ts/docx/document/body/columns.ts
Normal file
12
ts/docx/document/body/columns.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import {XmlComponent, Attributes} from "../../xml-components";
|
||||||
|
|
||||||
|
export class Columns {
|
||||||
|
private cols: Array<XmlComponent>;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.cols = new Array<XmlComponent>();
|
||||||
|
this.cols.push(new Attributes({
|
||||||
|
space: "708"
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
12
ts/docx/document/body/doc-grid.ts
Normal file
12
ts/docx/document/body/doc-grid.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import {XmlComponent, Attributes} from "../../xml-components";
|
||||||
|
|
||||||
|
export class DocumentGrid {
|
||||||
|
private docGrid: Array<XmlComponent>;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.docGrid = new Array<XmlComponent>();
|
||||||
|
this.docGrid.push(new Attributes({
|
||||||
|
linePitch: "360"
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
19
ts/docx/document/body/index.ts
Normal file
19
ts/docx/document/body/index.ts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import {XmlComponent, Attributes} from "../../xml-components";
|
||||||
|
import {SectionProperties} from "./section-properties";
|
||||||
|
import {PageSize} from "./page-size";
|
||||||
|
import {PageMargin} from "./page-margin";
|
||||||
|
import {Columns} from "./columns";
|
||||||
|
import {DocumentGrid} from "./doc-grid";
|
||||||
|
|
||||||
|
export class Body {
|
||||||
|
private body: Array<XmlComponent>;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.body = new Array<XmlComponent>();
|
||||||
|
this.body.push(new SectionProperties());
|
||||||
|
this.body.push(new PageSize());
|
||||||
|
this.body.push(new PageMargin());
|
||||||
|
this.body.push(new Columns());
|
||||||
|
this.body.push(new DocumentGrid());
|
||||||
|
}
|
||||||
|
}
|
18
ts/docx/document/body/page-margin.ts
Normal file
18
ts/docx/document/body/page-margin.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import {XmlComponent, Attributes} from "../../xml-components";
|
||||||
|
|
||||||
|
export class PageMargin {
|
||||||
|
private pgMar: Array<XmlComponent>;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.pgMar = new Array<XmlComponent>();
|
||||||
|
this.pgMar.push(new Attributes({
|
||||||
|
top: "1440",
|
||||||
|
right: "1440",
|
||||||
|
bottom: "1440",
|
||||||
|
left: "1440",
|
||||||
|
header: "708",
|
||||||
|
footer: "708",
|
||||||
|
gutter: "0"
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
13
ts/docx/document/body/page-size.ts
Normal file
13
ts/docx/document/body/page-size.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import {XmlComponent, Attributes} from "../../xml-components";
|
||||||
|
|
||||||
|
export class PageSize {
|
||||||
|
private pgSz: Array<XmlComponent>;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.pgSz = new Array<XmlComponent>();
|
||||||
|
this.pgSz.push(new Attributes({
|
||||||
|
w: "11906",
|
||||||
|
h: "16838"
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
14
ts/docx/document/body/section-properties.ts
Normal file
14
ts/docx/document/body/section-properties.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import {XmlComponent, Attributes} from "../../xml-components";
|
||||||
|
|
||||||
|
export class SectionProperties {
|
||||||
|
private sectPr: Array<XmlComponent>;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.sectPr = new Array<XmlComponent>();
|
||||||
|
this.sectPr.push(new Attributes({
|
||||||
|
rsidR: "00B64E8F",
|
||||||
|
rsidRPr: "00D842E4",
|
||||||
|
rsidSect: "000A6AD0"
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
15
ts/docx/document/index.ts
Normal file
15
ts/docx/document/index.ts
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import {XmlComponent, Attributes} from "../xml-components";
|
||||||
|
|
||||||
|
export class Document {
|
||||||
|
private document: Array<XmlComponent>;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.document = new Array<XmlComponent>();
|
||||||
|
this.document.push(new Attributes({}));
|
||||||
|
this.
|
||||||
|
}
|
||||||
|
|
||||||
|
test() {
|
||||||
|
return "hello";
|
||||||
|
}
|
||||||
|
}
|
@ -8,6 +8,19 @@ interface AttributesProperties {
|
|||||||
space?: string;
|
space?: string;
|
||||||
sz?: string;
|
sz?: string;
|
||||||
type?: string;
|
type?: string;
|
||||||
|
rsidR?: string;
|
||||||
|
rsidRPr?: string;
|
||||||
|
rsidSect?: string;
|
||||||
|
w?: string;
|
||||||
|
h?: string;
|
||||||
|
top?: string,
|
||||||
|
right?: string,
|
||||||
|
bottom?: string,
|
||||||
|
left?: string,
|
||||||
|
header?: string,
|
||||||
|
footer?: string,
|
||||||
|
gutter?: string,
|
||||||
|
linePitch?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Attributes implements XmlComponent {
|
export class Attributes implements XmlComponent {
|
||||||
|
21
ts/tests/bodyTest.ts
Normal file
21
ts/tests/bodyTest.ts
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/// <reference path="../typings/mocha/mocha.d.ts" />
|
||||||
|
/// <reference path="../typings/chai/chai.d.ts" />
|
||||||
|
import {Body} from "../docx/document/body";
|
||||||
|
import {assert} from "chai";
|
||||||
|
|
||||||
|
function jsonify(obj: Object) {
|
||||||
|
var stringifiedJson = JSON.stringify(obj);
|
||||||
|
return JSON.parse(stringifiedJson);
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Body', () => {
|
||||||
|
var body: Body;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
body = new Body();
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('#constructor()', () => {
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
Reference in New Issue
Block a user