Files
docx-js/src/file/file.ts

36 lines
1.1 KiB
TypeScript
Raw Normal View History

2018-09-19 00:37:11 +01:00
import { BaseFile } from "./base-file";
import { IPropertiesOptions } from "./core-properties";
2017-12-15 01:16:04 +00:00
import { Document } from "./document";
2018-09-19 00:37:11 +01:00
import { SectionPropertiesOptions } from "./document/body/section-properties";
export class File extends BaseFile {
constructor(
options: IPropertiesOptions = {
creator: "Un-named",
revision: "1",
lastModifiedBy: "Un-named",
},
sectionPropertiesOptions: SectionPropertiesOptions = {},
) {
super(options);
this.addDefaultRelationships();
this.createHeader();
this.createFooter();
2018-09-04 17:16:31 +03:00
2018-09-17 20:27:43 +01:00
sectionPropertiesOptions = {
...sectionPropertiesOptions,
headers: this.headers.map((header) => ({
headerId: header.header.Header.ReferenceId,
headerType: header.type,
})),
footers: this.footers.map((footer) => ({
footerId: footer.footer.Footer.ReferenceId,
footerType: footer.type,
})),
};
2018-09-04 17:16:31 +03:00
this.document = new Document(sectionPropertiesOptions);
2017-12-15 01:16:04 +00:00
}
}