2017-03-08 21:49:41 +00:00
|
|
|
import { DocumentAttributes } from "../docx/document/document-attributes";
|
|
|
|
import { XmlComponent } from "../docx/xml-components";
|
|
|
|
import { Created, Creator, Description, Keywords, LastModifiedBy, Modified, Revision, Subject, Title } from "./components";
|
2016-04-03 20:00:30 +01:00
|
|
|
|
2017-03-08 21:49:41 +00:00
|
|
|
interface IPropertiesOptions {
|
2016-04-03 20:00:30 +01:00
|
|
|
title?: string;
|
|
|
|
subject?: string;
|
|
|
|
creator?: string;
|
|
|
|
keywords?: string;
|
|
|
|
description?: string;
|
|
|
|
lastModifiedBy?: string;
|
|
|
|
revision?: string;
|
|
|
|
}
|
|
|
|
|
2016-04-09 20:16:35 +01:00
|
|
|
export class Properties extends XmlComponent {
|
2016-04-03 20:00:30 +01:00
|
|
|
|
2017-03-08 21:49:41 +00:00
|
|
|
constructor(options: IPropertiesOptions) {
|
2016-04-09 20:16:35 +01:00
|
|
|
super("cp:coreProperties");
|
|
|
|
this.root.push(new DocumentAttributes({
|
2016-04-03 20:00:30 +01:00
|
|
|
cp: "http://schemas.openxmlformats.org/package/2006/metadata/core-properties",
|
|
|
|
dc: "http://purl.org/dc/elements/1.1/",
|
|
|
|
dcterms: "http://purl.org/dc/terms/",
|
|
|
|
dcmitype: "http://purl.org/dc/dcmitype/",
|
2017-03-08 21:49:41 +00:00
|
|
|
xsi: "http://www.w3.org/2001/XMLSchema-instance",
|
2016-04-03 20:00:30 +01:00
|
|
|
}));
|
2016-04-09 20:16:35 +01:00
|
|
|
this.root.push(new Title(options.title));
|
|
|
|
this.root.push(new Subject(options.subject));
|
|
|
|
this.root.push(new Creator(options.creator));
|
|
|
|
this.root.push(new Keywords(options.keywords));
|
|
|
|
this.root.push(new Description(options.description));
|
|
|
|
this.root.push(new LastModifiedBy(options.lastModifiedBy));
|
|
|
|
this.root.push(new Revision(options.revision));
|
|
|
|
this.root.push(new Created());
|
|
|
|
this.root.push(new Modified());
|
2016-04-03 20:00:30 +01:00
|
|
|
}
|
2017-03-08 21:49:41 +00:00
|
|
|
}
|