From f789f60e2296df7c929a5758834b8aadf6bae6ca Mon Sep 17 00:00:00 2001 From: Dolan Date: Fri, 9 Dec 2022 21:07:08 +0000 Subject: [PATCH] Optional background property --- src/file/document/document.ts | 6 ++++-- src/file/file.ts | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/file/document/document.ts b/src/file/document/document.ts index 37e2f141eb..3af4aadf31 100644 --- a/src/file/document/document.ts +++ b/src/file/document/document.ts @@ -8,7 +8,7 @@ import { DocumentAttributes } from "./document-attributes"; import { DocumentBackground, IDocumentBackgroundOptions } from "./document-background"; export interface IDocumentOptions { - readonly background: IDocumentBackgroundOptions; + readonly background?: IDocumentBackgroundOptions; } // @@ -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); } diff --git a/src/file/file.ts b/src/file/file.ts index 383babc378..4b3f31dcdd 100644 --- a/src/file/file.ts +++ b/src/file/file.ts @@ -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,