Add dynamic relationships

This commit is contained in:
Dolan
2018-01-10 00:29:17 +00:00
parent a3945bc7f1
commit 592fb5ca9f
6 changed files with 64 additions and 6 deletions

View File

@ -0,0 +1,15 @@
import { XmlAttributeComponent } from "file/xml-components";
export interface IRelationshipAttributesProperties {
id: string;
type: string;
target: string;
}
export class RelationshipAttributes extends XmlAttributeComponent<IRelationshipAttributesProperties> {
protected xmlKeys = {
id: "Id",
type: "Type",
target: "Target",
};
}

View File

@ -0,0 +1,23 @@
import { XmlComponent } from "file/xml-components";
import { RelationshipAttributes } from "./relationship-attributes";
export type RelationshipType =
| "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"
| "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme"
| "http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings"
| "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"
| "http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable"
| "http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings"
| "http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering";
export class Relationship extends XmlComponent {
constructor(id: string, type: RelationshipType, target: string) {
super("Relationship");
this.root.push(new RelationshipAttributes({
id,
type,
target,
}));
}
}