Merge branch 'master' of https://github.com/h4buli/docx into feat/h4-update
# Conflicts: # package.json # src/file/document/body/body.ts # src/file/document/body/section-properties/section-properties.ts # src/file/file.ts # src/file/media/media.ts # src/file/styles/external-styles-factory.ts # src/file/table/table-cell.ts
This commit is contained in:
@ -12,7 +12,9 @@ import { PageMargin } from "./page-margin/page-margin";
|
||||
import { IPageMarginAttributes } from "./page-margin/page-margin-attributes";
|
||||
import { PageSize } from "./page-size/page-size";
|
||||
import { IPageSizeAttributes, PageOrientation } from "./page-size/page-size-attributes";
|
||||
import { FooterReferenceType, IPageNumberTypeAttributes, PageNumberType, PageNumberFormat } from ".";
|
||||
// import { TitlePage } from "./title-page/title-page";
|
||||
import { FooterReferenceType, IPageNumberTypeAttributes, PageNumberType, PageNumberFormat, PageBordersOptions, PageBorders } from ".";
|
||||
|
||||
export type SectionPropertiesOptions = IPageSizeAttributes &
|
||||
IPageMarginAttributes &
|
||||
@ -20,7 +22,8 @@ export type SectionPropertiesOptions = IPageSizeAttributes &
|
||||
IDocGridAttributesProperties &
|
||||
IHeaderOptions &
|
||||
IFooterOptions &
|
||||
IPageNumberTypeAttributes;
|
||||
IPageNumberTypeAttributes &
|
||||
PageBordersOptions;
|
||||
|
||||
export class SectionProperties extends XmlComponent {
|
||||
private readonly options: SectionPropertiesOptions;
|
||||
@ -47,6 +50,11 @@ export class SectionProperties extends XmlComponent {
|
||||
footerId: 0,
|
||||
pageNumberStart: undefined,
|
||||
pageNumberFormatType: PageNumberFormat.DECIMAL,
|
||||
pageBorders: undefined,
|
||||
pageBorderTop: undefined,
|
||||
pageBorderRight: undefined,
|
||||
pageBorderBottom: undefined,
|
||||
pageBorderLeft: undefined,
|
||||
};
|
||||
|
||||
const mergedOptions = {
|
||||
@ -84,6 +92,24 @@ export class SectionProperties extends XmlComponent {
|
||||
|
||||
this.root.push(new PageNumberType(mergedOptions.pageNumberStart, mergedOptions.pageNumberFormatType));
|
||||
|
||||
if (
|
||||
mergedOptions.pageBorders ||
|
||||
mergedOptions.pageBorderTop ||
|
||||
mergedOptions.pageBorderRight ||
|
||||
mergedOptions.pageBorderBottom ||
|
||||
mergedOptions.pageBorderLeft
|
||||
) {
|
||||
this.root.push(
|
||||
new PageBorders({
|
||||
pageBorders: mergedOptions.pageBorders,
|
||||
pageBorderTop: mergedOptions.pageBorderTop,
|
||||
pageBorderRight: mergedOptions.pageBorderRight,
|
||||
pageBorderBottom: mergedOptions.pageBorderBottom,
|
||||
pageBorderLeft: mergedOptions.pageBorderLeft,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
this.options = mergedOptions;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user