Merge pull request #156 from bre7/master

Added mirror margins option
This commit is contained in:
Dolan
2018-09-19 12:40:31 +01:00
committed by GitHub
5 changed files with 16 additions and 1 deletions

4
.gitignore vendored
View File

@ -48,8 +48,12 @@ docs/.nojekyll
!.vscode/extensions.json
.history
# IntelliJ
.idea
# Lock files
package-lock.json
yarn.lock
# Documents
My Document.docx

View File

@ -8,6 +8,7 @@ export interface IPageMarginAttributes {
header?: number;
footer?: number;
gutter?: number;
mirror?: boolean;
}
export class PageMarginAttributes extends XmlAttributeComponent<IPageMarginAttributes> {
@ -19,5 +20,6 @@ export class PageMarginAttributes extends XmlAttributeComponent<IPageMarginAttri
header: "w:header",
footer: "w:footer",
gutter: "w:gutter",
mirror: "w:mirrorMargins",
};
}

View File

@ -2,7 +2,7 @@ import { XmlComponent } from "file/xml-components";
import { PageMarginAttributes } from "./page-margin-attributes";
export class PageMargin extends XmlComponent {
constructor(top: number, right: number, bottom: number, left: number, header: number, footer: number, gutter: number) {
constructor(top: number, right: number, bottom: number, left: number, header: number, footer: number, gutter: number, mirror: boolean) {
super("w:pgMar");
this.root.push(
new PageMarginAttributes({
@ -13,6 +13,7 @@ export class PageMargin extends XmlComponent {
header: header,
footer: footer,
gutter: gutter,
mirror: mirror,
}),
);
}

View File

@ -17,6 +17,7 @@ describe("SectionProperties", () => {
header: 708,
footer: 708,
gutter: 0,
mirror: false,
space: 708,
linePitch: 360,
headerId: 100,
@ -40,6 +41,7 @@ describe("SectionProperties", () => {
"w:left": 1440,
"w:header": 708,
"w:gutter": 0,
"w:mirrorMargins": false,
},
},
],
@ -69,6 +71,7 @@ describe("SectionProperties", () => {
"w:left": 1440,
"w:header": 708,
"w:gutter": 0,
"w:mirrorMargins": false,
},
},
],
@ -99,6 +102,7 @@ describe("SectionProperties", () => {
"w:left": 1440,
"w:header": 708,
"w:gutter": 0,
"w:mirrorMargins": false,
},
},
],
@ -124,6 +128,7 @@ describe("SectionProperties", () => {
"w:left": 1440,
"w:header": 708,
"w:gutter": 0,
"w:mirrorMargins": false,
},
},
],
@ -150,6 +155,7 @@ describe("SectionProperties", () => {
"w:left": 1440,
"w:header": 708,
"w:gutter": 0,
"w:mirrorMargins": false,
},
},
],

View File

@ -38,6 +38,7 @@ export class SectionProperties extends XmlComponent {
header: 708,
footer: 708,
gutter: 0,
mirror: false,
space: 708,
linePitch: 360,
orientation: PageOrientation.PORTRAIT,
@ -69,6 +70,7 @@ export class SectionProperties extends XmlComponent {
mergedOptions.header,
mergedOptions.footer,
mergedOptions.gutter,
mergedOptions.mirror,
),
);
this.root.push(new Columns(mergedOptions.space));