2018-01-10 00:29:17 +00:00
|
|
|
import { Relationships } from "file/relationships";
|
2017-12-15 01:16:04 +00:00
|
|
|
import { Document } from "./document";
|
2017-12-20 00:06:08 +00:00
|
|
|
import { Media } from "./media";
|
2017-12-20 00:01:23 +00:00
|
|
|
import { Numbering } from "./numbering";
|
|
|
|
import { Paragraph } from "./paragraph";
|
2017-12-20 00:58:24 +00:00
|
|
|
import { IPropertiesOptions, Properties } from "./properties";
|
2017-12-20 00:52:41 +00:00
|
|
|
import { Styles } from "./styles";
|
|
|
|
import { DefaultStylesFactory } from "./styles/factory";
|
2017-12-20 00:01:23 +00:00
|
|
|
import { Table } from "./table";
|
2017-12-15 01:16:04 +00:00
|
|
|
|
|
|
|
export class File {
|
|
|
|
|
|
|
|
private document: Document;
|
|
|
|
private styles: Styles;
|
|
|
|
private properties: Properties;
|
|
|
|
private numbering: Numbering;
|
|
|
|
private media: Media;
|
2018-01-10 00:29:17 +00:00
|
|
|
private relationships: Relationships;
|
2017-12-15 01:16:04 +00:00
|
|
|
|
2017-12-15 02:15:44 +00:00
|
|
|
constructor(options?: IPropertiesOptions) {
|
2017-12-15 01:16:04 +00:00
|
|
|
this.document = new Document();
|
2017-12-15 02:15:44 +00:00
|
|
|
const stylesFactory = new DefaultStylesFactory();
|
|
|
|
this.styles = stylesFactory.newInstance();
|
|
|
|
|
|
|
|
if (!options) {
|
|
|
|
options = {
|
|
|
|
creator: "Un-named",
|
|
|
|
revision: "1",
|
|
|
|
lastModifiedBy: "Un-named",
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
this.properties = new Properties(options);
|
2017-12-15 01:16:04 +00:00
|
|
|
this.numbering = new Numbering();
|
|
|
|
this.media = new Media();
|
2018-01-10 00:29:17 +00:00
|
|
|
this.relationships = new Relationships();
|
2017-12-15 01:16:04 +00:00
|
|
|
}
|
2017-12-15 02:15:44 +00:00
|
|
|
|
|
|
|
public addParagraph(paragraph: Paragraph): void {
|
|
|
|
this.document.addParagraph(paragraph);
|
|
|
|
}
|
|
|
|
|
|
|
|
public createParagraph(text?: string): Paragraph {
|
|
|
|
return this.document.createParagraph();
|
|
|
|
}
|
|
|
|
|
|
|
|
public addTable(table: Table): void {
|
|
|
|
return this.document.addTable(table);
|
|
|
|
}
|
|
|
|
|
|
|
|
public createTable(rows: number, cols: number): Table {
|
|
|
|
return this.document.createTable(rows, cols);
|
|
|
|
}
|
|
|
|
|
|
|
|
public get Document(): Document {
|
|
|
|
return this.document;
|
|
|
|
}
|
|
|
|
|
|
|
|
public get Styles(): Styles {
|
|
|
|
return this.styles;
|
|
|
|
}
|
|
|
|
|
|
|
|
public get Properties(): Properties {
|
|
|
|
return this.properties;
|
|
|
|
}
|
|
|
|
|
|
|
|
public get Numbering(): Numbering {
|
|
|
|
return this.numbering;
|
|
|
|
}
|
|
|
|
|
|
|
|
public get Media(): Media {
|
|
|
|
return this.media;
|
|
|
|
}
|
2018-01-10 00:29:17 +00:00
|
|
|
|
|
|
|
public get Relationships(): Relationships {
|
|
|
|
return this.relationships;
|
|
|
|
}
|
2017-12-15 01:16:04 +00:00
|
|
|
}
|