Mandatory Sections

This commit is contained in:
Dolan Miu
2019-07-31 08:48:02 +01:00
parent bf80311ef7
commit ac5b15d0e3
63 changed files with 1194 additions and 1588 deletions

View File

@ -4,13 +4,12 @@ import { Paragraph } from "../paragraph";
import { Table } from "../table";
import { TableOfContents } from "../table-of-contents";
import { Body } from "./body";
import { SectionPropertiesOptions } from "./body/section-properties";
import { DocumentAttributes } from "./document-attributes";
export class Document extends XmlComponent {
private readonly body: Body;
constructor(sectionPropertiesOptions?: SectionPropertiesOptions) {
constructor() {
super("w:document");
this.root.push(
new DocumentAttributes({
@ -33,17 +32,12 @@ export class Document extends XmlComponent {
Ignorable: "w14 w15 wp14",
}),
);
this.body = new Body(sectionPropertiesOptions);
this.body = new Body();
this.root.push(this.body);
}
public add(paragraph: Paragraph | Table): Document {
this.body.push(paragraph);
return this;
}
public addTableOfContents(toc: TableOfContents): Document {
this.body.push(toc);
public add(item: Paragraph | Table | TableOfContents): Document {
this.body.push(item);
return this;
}
@ -54,8 +48,4 @@ export class Document extends XmlComponent {
public getTablesOfContents(): TableOfContents[] {
return this.body.getTablesOfContents();
}
public getParagraphs(): Paragraph[] {
return this.body.getParagraphs();
}
}