refactor code
This commit is contained in:
@ -7,7 +7,7 @@ const doc = new Document();
|
|||||||
|
|
||||||
doc.addSection({
|
doc.addSection({
|
||||||
properties: {
|
properties: {
|
||||||
valign: SectionVerticalAlignValue.Center,
|
verticalAlign: SectionVerticalAlignValue.CENTER,
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
new Paragraph({
|
new Paragraph({
|
||||||
|
@ -89,7 +89,7 @@ export class SectionProperties extends XmlComponent {
|
|||||||
pageBorderBottom,
|
pageBorderBottom,
|
||||||
pageBorderLeft,
|
pageBorderLeft,
|
||||||
titlePage = false,
|
titlePage = false,
|
||||||
valign,
|
verticalAlign,
|
||||||
} = options;
|
} = options;
|
||||||
|
|
||||||
this.options = options;
|
this.options = options;
|
||||||
@ -125,8 +125,8 @@ export class SectionProperties extends XmlComponent {
|
|||||||
this.root.push(new TitlePage());
|
this.root.push(new TitlePage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (valign) {
|
if (verticalAlign) {
|
||||||
this.root.push(new SectionVerticalAlign(valign));
|
this.root.push(new SectionVerticalAlign(verticalAlign));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,11 +2,11 @@ import { XmlAttributeComponent } from "file/xml-components";
|
|||||||
import { SectionVerticalAlignValue } from "./vertical-align";
|
import { SectionVerticalAlignValue } from "./vertical-align";
|
||||||
|
|
||||||
export interface ISectionVerticalAlignAttributes {
|
export interface ISectionVerticalAlignAttributes {
|
||||||
readonly valign?: SectionVerticalAlignValue;
|
readonly verticalAlign?: SectionVerticalAlignValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SectionVerticalAlignAttributes extends XmlAttributeComponent<ISectionVerticalAlignAttributes> {
|
export class SectionVerticalAlignAttributes extends XmlAttributeComponent<ISectionVerticalAlignAttributes> {
|
||||||
protected readonly xmlKeys = {
|
protected readonly xmlKeys = {
|
||||||
valign: "w:val",
|
verticalAlign: "w:val",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -4,15 +4,15 @@ import { XmlComponent } from "file/xml-components";
|
|||||||
import { SectionVerticalAlignAttributes } from "./vertical-align-attributes";
|
import { SectionVerticalAlignAttributes } from "./vertical-align-attributes";
|
||||||
|
|
||||||
export enum SectionVerticalAlignValue {
|
export enum SectionVerticalAlignValue {
|
||||||
Both = "both",
|
BOTH = "both",
|
||||||
Bottom = "bottom",
|
BOTTOM = "bottom",
|
||||||
Center = "center",
|
CENTER = "center",
|
||||||
Top = "top",
|
TOP = "top",
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SectionVerticalAlign extends XmlComponent {
|
export class SectionVerticalAlign extends XmlComponent {
|
||||||
constructor(value: SectionVerticalAlignValue) {
|
constructor(value: SectionVerticalAlignValue) {
|
||||||
super("w:vAlign");
|
super("w:vAlign");
|
||||||
this.root.push(new SectionVerticalAlignAttributes({ valign: value }));
|
this.root.push(new SectionVerticalAlignAttributes({ verticalAlign: value }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user