Added mirror margins options

This commit is contained in:
bre7
2018-09-18 21:03:20 -03:00
parent 53b24965aa
commit fcb542471b
3 changed files with 6 additions and 1 deletions

View File

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

View File

@ -2,7 +2,7 @@ import { XmlComponent } from "file/xml-components";
import { PageMarginAttributes } from "./page-margin-attributes"; import { PageMarginAttributes } from "./page-margin-attributes";
export class PageMargin extends XmlComponent { 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"); super("w:pgMar");
this.root.push( this.root.push(
new PageMarginAttributes({ new PageMarginAttributes({
@ -13,6 +13,7 @@ export class PageMargin extends XmlComponent {
header: header, header: header,
footer: footer, footer: footer,
gutter: gutter, gutter: gutter,
mirror: mirror,
}), }),
); );
} }

View File

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