Add dynamic relationships
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
import { RelationshipsAttributes } from "./attributes";
|
||||
import { Relationship, RelationshipType } from "./relationship/relationship";
|
||||
|
||||
export class Relationships extends XmlComponent {
|
||||
|
||||
@ -9,6 +10,18 @@ export class Relationships extends XmlComponent {
|
||||
xmlns: "http://schemas.openxmlformats.org/package/2006/relationships",
|
||||
}));
|
||||
|
||||
// this.root.push(new Created());
|
||||
this.createRelationship(1, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles", "styles.xml");
|
||||
this.createRelationship(2, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering", "numbering.xml");
|
||||
}
|
||||
|
||||
public addRelationship(relationship: Relationship): void {
|
||||
this.root.push(relationship);
|
||||
}
|
||||
|
||||
public createRelationship(id: number, type: RelationshipType, target: string): Relationship {
|
||||
const relationship = new Relationship(`rId${id}`, type, target);
|
||||
this.addRelationship(relationship);
|
||||
|
||||
return relationship;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user