Merge pull request #1830 from dolanmiu/feat/optional-background

Optional background property
This commit is contained in:
Dolan
2022-12-10 00:12:01 +00:00
committed by GitHub
2 changed files with 5 additions and 3 deletions

View File

@ -8,7 +8,7 @@ import { DocumentAttributes } from "./document-attributes";
import { DocumentBackground, IDocumentBackgroundOptions } from "./document-background";
export interface IDocumentOptions {
readonly background: IDocumentBackgroundOptions;
readonly background?: IDocumentBackgroundOptions;
}
// <xsd:element name="document" type="CT_Document"/>
@ -73,7 +73,9 @@ export class Document extends XmlComponent {
}),
);
this.body = new Body();
this.root.push(new DocumentBackground(options.background));
if (options.background) {
this.root.push(new DocumentBackground(options.background));
}
this.root.push(this.body);
}

View File

@ -73,7 +73,7 @@ export class File {
this.appProperties = new AppProperties();
this.footnotesWrapper = new FootnotesWrapper();
this.contentTypes = new ContentTypes();
this.documentWrapper = new DocumentWrapper({ background: options.background || {} });
this.documentWrapper = new DocumentWrapper({ background: options.background });
this.settings = new Settings({
compatibilityModeVersion: options.compatabilityModeVersion,
compatibility: options.compatibility,