Mandatory Sections
This commit is contained in:
@ -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();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user