Merge from master
This commit is contained in:
@ -11,10 +11,12 @@ import { Image, Media } from "./media";
|
||||
import { Numbering } from "./numbering";
|
||||
import { Bookmark, Hyperlink, Paragraph } from "./paragraph";
|
||||
import { Relationships } from "./relationships";
|
||||
import { Settings } from "./settings";
|
||||
import { Styles } from "./styles";
|
||||
import { ExternalStylesFactory } from "./styles/external-styles-factory";
|
||||
import { DefaultStylesFactory } from "./styles/factory";
|
||||
import { Table } from "./table";
|
||||
import { TableOfContents } from "./table-of-contents";
|
||||
|
||||
export class File {
|
||||
private currentRelationshipId: number = 1;
|
||||
@ -28,6 +30,7 @@ export class File {
|
||||
private readonly media: Media;
|
||||
private readonly fileRelationships: Relationships;
|
||||
private readonly footNotes: FootNotes;
|
||||
private readonly settings: Settings;
|
||||
private readonly contentTypes: ContentTypes;
|
||||
private readonly appProperties: AppProperties;
|
||||
private styles: Styles;
|
||||
@ -93,6 +96,11 @@ export class File {
|
||||
};
|
||||
|
||||
this.document = new Document(sectionPropertiesOptions);
|
||||
this.settings = new Settings();
|
||||
}
|
||||
|
||||
public addTableOfContents(toc: TableOfContents): void {
|
||||
this.document.addTableOfContents(toc);
|
||||
}
|
||||
|
||||
public addParagraph(paragraph: Paragraph): File {
|
||||
@ -199,6 +207,12 @@ export class File {
|
||||
throw new Error(`There is no header with given reference id ${refId}`);
|
||||
}
|
||||
|
||||
public verifyUpdateFields(): void {
|
||||
if (this.document.getTablesOfContents().length) {
|
||||
this.settings.addUpdateFields();
|
||||
}
|
||||
}
|
||||
|
||||
protected addHeaderToDocument(header: HeaderWrapper, type: HeaderReferenceType = HeaderReferenceType.DEFAULT): void {
|
||||
this.headers.push({ header, type });
|
||||
this.docRelationships.createRelationship(
|
||||
@ -296,4 +310,8 @@ export class File {
|
||||
public get FootNotes(): FootNotes {
|
||||
return this.footNotes;
|
||||
}
|
||||
|
||||
public get Settings(): Settings {
|
||||
return this.settings;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user