2017-12-15 01:16:04 +00:00
|
|
|
import { Media } from "../media";
|
|
|
|
import { Numbering } from "../numbering";
|
2017-12-15 02:15:44 +00:00
|
|
|
import { IPropertiesOptions, Properties } from "../properties";
|
2017-12-15 01:16:04 +00:00
|
|
|
import { Styles } from "../styles";
|
2017-12-15 02:15:44 +00:00
|
|
|
import { DefaultStylesFactory } from "../styles/factory";
|
2017-12-15 01:16:04 +00:00
|
|
|
import { Document } from "./document";
|
2017-12-15 02:15:44 +00:00
|
|
|
import { Paragraph, Table } from "./index";
|
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;
|
|
|
|
|
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();
|
|
|
|
}
|
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;
|
|
|
|
}
|
2017-12-15 01:16:04 +00:00
|
|
|
}
|