Restart page numbering

Add separator option
This commit is contained in:
Dolan Miu
2020-02-28 18:44:41 +00:00
parent 1c8cd325d7
commit 5bca7d155f
3 changed files with 106 additions and 16 deletions

View File

@ -56,12 +56,8 @@ export type SectionPropertiesOptions = IPageSizeAttributes &
// Need to decouple this from the attributes
export class SectionProperties extends XmlComponent {
private readonly options: SectionPropertiesOptions;
constructor(options: SectionPropertiesOptions = { column: {} }) {
super("w:sectPr");
const {
constructor(
{
width = 11906,
height = 16838,
top = 1440,
@ -79,6 +75,7 @@ export class SectionProperties extends XmlComponent {
footers,
pageNumberFormatType,
pageNumberStart,
pageNumberSeparator,
lineNumberCountBy,
lineNumberStart,
lineNumberRestart,
@ -90,9 +87,10 @@ export class SectionProperties extends XmlComponent {
pageBorderLeft,
titlePage = false,
verticalAlign,
} = options;
}: SectionPropertiesOptions = { column: {} },
) {
super("w:sectPr");
this.options = options;
this.root.push(new PageSize(width, height, orientation));
this.root.push(new PageMargin(top, right, bottom, left, header, footer, gutter, mirror));
this.root.push(new Columns(column.space ? column.space : 708, column.count ? column.count : 1));
@ -101,9 +99,7 @@ export class SectionProperties extends XmlComponent {
this.addHeaders(headers);
this.addFooters(footers);
if (pageNumberStart || pageNumberFormatType) {
this.root.push(new PageNumberType(pageNumberStart, pageNumberFormatType));
}
this.root.push(new PageNumberType(pageNumberStart, pageNumberFormatType, pageNumberSeparator));
if (lineNumberCountBy || lineNumberStart || lineNumberRestart || lineNumberDistance) {
this.root.push(new LineNumberType(lineNumberCountBy, lineNumberStart, lineNumberRestart, lineNumberDistance));
@ -191,8 +187,4 @@ export class SectionProperties extends XmlComponent {
}
}
}
public get Options(): SectionPropertiesOptions {
return this.options;
}
}