Background color for document

This commit is contained in:
Dolan
2020-10-27 01:54:40 +00:00
parent 214afab711
commit ed52ef358b
14 changed files with 203 additions and 14 deletions

View File

@ -5,11 +5,16 @@ import { Table } from "../table";
import { TableOfContents } from "../table-of-contents";
import { Body } from "./body";
import { DocumentAttributes } from "./document-attributes";
import { DocumentBackground, IDocumentBackgroundOptions } from "./document-background";
interface IDocumentOptions {
readonly background: IDocumentBackgroundOptions;
}
export class Document extends XmlComponent {
private readonly body: Body;
constructor() {
constructor(options: IDocumentOptions) {
super("w:document");
this.root.push(
new DocumentAttributes({
@ -33,6 +38,7 @@ export class Document extends XmlComponent {
}),
);
this.body = new Body();
this.root.push(new DocumentBackground(options.background));
this.root.push(this.body);
}