Add more content type files

This commit is contained in:
Dolan Miu
2018-02-03 20:56:20 +00:00
parent cfd3505414
commit 69707a7207
5 changed files with 55 additions and 3 deletions

View File

@ -1,5 +1,6 @@
import { XmlComponent } from "file/xml-components";
import { ContentTypeAttributes } from "./content-types-attributes";
import { Default } from "./default/default";
export class ContentTypes extends XmlComponent {
constructor() {
@ -10,5 +11,22 @@ export class ContentTypes extends XmlComponent {
xmlns: "http://schemas.openxmlformats.org/package/2006/content-types",
}),
);
this.root.push(new Default("image/png", "png"));
this.root.push(new Default("image/jpeg", "jpeg"));
this.root.push(new Default("image/jpeg", "jpg"));
this.root.push(new Default("image/bmp", "bmp"));
this.root.push(new Default("image/gif", "gif"));
this.root.push(new Default("application/vnd.openxmlformats-package.relationships+xml", "rels"));
this.root.push(new Default("application/xml", "xml"));
this.root.push(new Default("application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml", undefined, "/word/document.xml"));
this.root.push(new Default("application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml", undefined, "/word/header1.xml"));
this.root.push(new Default("application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml", undefined, "/word/footer1.xml"));
this.root.push(new Default("application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml", undefined, "/word/styles.xml"));
this.root.push(new Default("application/vnd.openxmlformats-package.core-properties+xml", undefined, "/docProps/core.xml"));
this.root.push(new Default("application/vnd.openxmlformats-officedocument.extended-properties+xml", undefined, "/docProps/app.xml"));
this.root.push(new Default("application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml", undefined, "/word/numbering.xml"));
}
}

View File

@ -0,0 +1,15 @@
import { XmlAttributeComponent } from "file/xml-components";
export interface IDefaultAttributes {
contentType: string;
extension?: string;
partName?: string;
}
export class DefaultAttributes extends XmlAttributeComponent<IDefaultAttributes> {
protected xmlKeys = {
contentType: "ContentType",
extension: "Extension",
partName: "PartName",
};
}

View File

@ -1,9 +1,16 @@
import { XmlComponent } from "file/xml-components";
import { DefaultAttributes } from "./default-attributes";
export class Default extends XmlComponent {
constructor() {
super("Types");
constructor(contentType: string, extension?: string, partName?: string) {
super("Default");
this.root.push();
this.root.push(
new DefaultAttributes({
contentType: contentType,
extension: extension,
partName: partName,
}),
);
}
}