Change docx folder to more appropriate "file" folder

This commit is contained in:
Dolan
2017-12-20 01:03:20 +00:00
parent 43ebfe7a2f
commit 2358139a6b
117 changed files with 22 additions and 23 deletions

View File

@ -0,0 +1,50 @@
import { assert } from "chai";
import { Utility } from "../../../tests/utility";
import { Body } from "./";
import { Columns } from "./columns";
import { DocumentGrid } from "./doc-grid";
import { PageMargin } from "./page-margin";
import { PageSize } from "./page-size";
import { SectionProperties } from "./section-properties";
describe("Body", () => {
let body: Body;
beforeEach(() => {
body = new Body();
body.push(new SectionProperties());
body.push(new PageSize());
body.push(new PageMargin());
body.push(new Columns());
body.push(new DocumentGrid());
});
describe("#constructor()", () => {
it("should create the Section Properties", () => {
const newJson = Utility.jsonify(body);
assert.equal(newJson.root[0].rootKey, "w:sectPr");
});
it("should create the Page Size", () => {
const newJson = Utility.jsonify(body);
assert.equal(newJson.root[1].rootKey, "w:pgSz");
});
it("should create the Page Margin", () => {
const newJson = Utility.jsonify(body);
assert.equal(newJson.root[2].rootKey, "w:pgMar");
});
it("should create the Columns", () => {
const newJson = Utility.jsonify(body);
assert.equal(newJson.root[3].rootKey, "w:cols");
});
it("should create the Document Grid", () => {
const newJson = Utility.jsonify(body);
assert.equal(newJson.root[4].rootKey, "w:docGrid");
});
});
});

View File

@ -0,0 +1,12 @@
import { XmlComponent } from "../../xml-components";
export class Body extends XmlComponent {
constructor() {
super("w:body");
}
public push(component: XmlComponent): void {
this.root.push(component);
}
}

View File

@ -0,0 +1,11 @@
import { Attributes, XmlComponent } from "../../xml-components";
export class Columns extends XmlComponent {
constructor() {
super("w:cols");
this.root.push(new Attributes({
space: "708",
}));
}
}

View File

@ -0,0 +1,11 @@
import { Attributes, XmlComponent } from "../../xml-components";
export class DocumentGrid extends XmlComponent {
constructor() {
super("w:docGrid");
this.root.push(new Attributes({
linePitch: "360",
}));
}
}

View File

@ -0,0 +1 @@
export * from "./body";

View File

@ -0,0 +1,17 @@
import { Attributes, XmlComponent } from "../../xml-components";
export class PageMargin extends XmlComponent {
constructor() {
super("w:pgMar");
this.root.push(new Attributes({
top: "1440",
right: "1440",
bottom: "1440",
left: "1440",
header: "708",
footer: "708",
gutter: "0",
}));
}
}

View File

@ -0,0 +1,12 @@
import { Attributes, XmlComponent } from "../../xml-components";
export class PageSize extends XmlComponent {
constructor() {
super("w:pgSz");
this.root.push(new Attributes({
w: "11906",
h: "16838",
}));
}
}

View File

@ -0,0 +1,21 @@
import { Attributes, XmlComponent } from "../../xml-components";
import { Columns } from "./columns";
import { DocumentGrid } from "./doc-grid";
import { PageMargin } from "./page-margin";
import { PageSize } from "./page-size";
export class SectionProperties extends XmlComponent {
constructor() {
super("w:sectPr");
this.root.push(new Attributes({
rsidR: "00B64E8F",
rsidRPr: "00D842E4",
rsidSect: "000A6AD0",
}));
this.root.push(new PageSize());
this.root.push(new PageMargin());
this.root.push(new Columns());
this.root.push(new DocumentGrid());
}
}