diff --git a/ts/docx/body.ts b/ts/docx/body.ts deleted file mode 100644 index f72aa8c1ba..0000000000 --- a/ts/docx/body.ts +++ /dev/null @@ -1,3 +0,0 @@ -export class Body { - -} diff --git a/ts/docx/document.ts b/ts/docx/document.ts deleted file mode 100644 index 0ce98f3571..0000000000 --- a/ts/docx/document.ts +++ /dev/null @@ -1,11 +0,0 @@ -export class Document { - private body: string; - - constructor() { - this.body = "ggg"; - } - - test() { - return "hello"; - } -} \ No newline at end of file diff --git a/ts/docx/document/body/columns.ts b/ts/docx/document/body/columns.ts new file mode 100644 index 0000000000..d656fafeaf --- /dev/null +++ b/ts/docx/document/body/columns.ts @@ -0,0 +1,12 @@ +import {XmlComponent, Attributes} from "../../xml-components"; + +export class Columns { + private cols: Array; + + constructor() { + this.cols = new Array(); + this.cols.push(new Attributes({ + space: "708" + })); + } +} \ No newline at end of file diff --git a/ts/docx/document/body/doc-grid.ts b/ts/docx/document/body/doc-grid.ts new file mode 100644 index 0000000000..3bc9bf2cb2 --- /dev/null +++ b/ts/docx/document/body/doc-grid.ts @@ -0,0 +1,12 @@ +import {XmlComponent, Attributes} from "../../xml-components"; + +export class DocumentGrid { + private docGrid: Array; + + constructor() { + this.docGrid = new Array(); + this.docGrid.push(new Attributes({ + linePitch: "360" + })); + } +} \ No newline at end of file diff --git a/ts/docx/document/body/index.ts b/ts/docx/document/body/index.ts new file mode 100644 index 0000000000..df1cc8c166 --- /dev/null +++ b/ts/docx/document/body/index.ts @@ -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; + + constructor() { + this.body = new Array(); + 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()); + } +} diff --git a/ts/docx/document/body/page-margin.ts b/ts/docx/document/body/page-margin.ts new file mode 100644 index 0000000000..4bd9861a99 --- /dev/null +++ b/ts/docx/document/body/page-margin.ts @@ -0,0 +1,18 @@ +import {XmlComponent, Attributes} from "../../xml-components"; + +export class PageMargin { + private pgMar: Array; + + constructor() { + this.pgMar = new Array(); + this.pgMar.push(new Attributes({ + top: "1440", + right: "1440", + bottom: "1440", + left: "1440", + header: "708", + footer: "708", + gutter: "0" + })); + } +} \ No newline at end of file diff --git a/ts/docx/document/body/page-size.ts b/ts/docx/document/body/page-size.ts new file mode 100644 index 0000000000..bc8b6da2b9 --- /dev/null +++ b/ts/docx/document/body/page-size.ts @@ -0,0 +1,13 @@ +import {XmlComponent, Attributes} from "../../xml-components"; + +export class PageSize { + private pgSz: Array; + + constructor() { + this.pgSz = new Array(); + this.pgSz.push(new Attributes({ + w: "11906", + h: "16838" + })); + } +} \ No newline at end of file diff --git a/ts/docx/document/body/section-properties.ts b/ts/docx/document/body/section-properties.ts new file mode 100644 index 0000000000..28a2494aa3 --- /dev/null +++ b/ts/docx/document/body/section-properties.ts @@ -0,0 +1,14 @@ +import {XmlComponent, Attributes} from "../../xml-components"; + +export class SectionProperties { + private sectPr: Array; + + constructor() { + this.sectPr = new Array(); + this.sectPr.push(new Attributes({ + rsidR: "00B64E8F", + rsidRPr: "00D842E4", + rsidSect: "000A6AD0" + })); + } +} \ No newline at end of file diff --git a/ts/docx/document/index.ts b/ts/docx/document/index.ts new file mode 100644 index 0000000000..227ff7f245 --- /dev/null +++ b/ts/docx/document/index.ts @@ -0,0 +1,15 @@ +import {XmlComponent, Attributes} from "../xml-components"; + +export class Document { + private document: Array; + + constructor() { + this.document = new Array(); + this.document.push(new Attributes({})); + this. + } + + test() { + return "hello"; + } +} \ No newline at end of file diff --git a/ts/docx/xml-components/index.ts b/ts/docx/xml-components/index.ts index 66665cd3e2..b415ac616a 100644 --- a/ts/docx/xml-components/index.ts +++ b/ts/docx/xml-components/index.ts @@ -8,6 +8,19 @@ interface AttributesProperties { space?: string; sz?: 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 { diff --git a/ts/tests/bodyTest.ts b/ts/tests/bodyTest.ts new file mode 100644 index 0000000000..1b89b7080f --- /dev/null +++ b/ts/tests/bodyTest.ts @@ -0,0 +1,21 @@ +/// +/// +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()', () => { + + }); +}); \ No newline at end of file