modify relationships to support external links
This commit is contained in:
@ -4,6 +4,7 @@ export interface IRelationshipAttributesProperties {
|
|||||||
id: string;
|
id: string;
|
||||||
type: string;
|
type: string;
|
||||||
target: string;
|
target: string;
|
||||||
|
targetMode?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class RelationshipAttributes extends XmlAttributeComponent<IRelationshipAttributesProperties> {
|
export class RelationshipAttributes extends XmlAttributeComponent<IRelationshipAttributesProperties> {
|
||||||
@ -11,5 +12,6 @@ export class RelationshipAttributes extends XmlAttributeComponent<IRelationshipA
|
|||||||
id: "Id",
|
id: "Id",
|
||||||
type: "Type",
|
type: "Type",
|
||||||
target: "Target",
|
target: "Target",
|
||||||
|
targetMode: "TargetMode",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -13,10 +13,13 @@ export type RelationshipType =
|
|||||||
| "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer"
|
| "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer"
|
||||||
| "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"
|
| "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"
|
||||||
| "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties"
|
| "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties"
|
||||||
| "http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties";
|
| "http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties"
|
||||||
|
| "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink";
|
||||||
|
|
||||||
|
export type TargetModeType = "External";
|
||||||
|
|
||||||
export class Relationship extends XmlComponent {
|
export class Relationship extends XmlComponent {
|
||||||
constructor(id: string, type: RelationshipType, target: string) {
|
constructor(id: string, type: RelationshipType, target: string, targetMode?: TargetModeType) {
|
||||||
super("Relationship");
|
super("Relationship");
|
||||||
|
|
||||||
this.root.push(
|
this.root.push(
|
||||||
@ -24,6 +27,7 @@ export class Relationship extends XmlComponent {
|
|||||||
id,
|
id,
|
||||||
type,
|
type,
|
||||||
target,
|
target,
|
||||||
|
targetMode,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { XmlComponent } from "file/xml-components";
|
import { XmlComponent } from "file/xml-components";
|
||||||
import { RelationshipsAttributes } from "./attributes";
|
import { RelationshipsAttributes } from "./attributes";
|
||||||
import { Relationship, RelationshipType } from "./relationship/relationship";
|
import { Relationship, RelationshipType, TargetModeType } from "./relationship/relationship";
|
||||||
|
|
||||||
export class Relationships extends XmlComponent {
|
export class Relationships extends XmlComponent {
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -16,8 +16,8 @@ export class Relationships extends XmlComponent {
|
|||||||
this.root.push(relationship);
|
this.root.push(relationship);
|
||||||
}
|
}
|
||||||
|
|
||||||
public createRelationship(id: number, type: RelationshipType, target: string): Relationship {
|
public createRelationship(id: number, type: RelationshipType, target: string, targetMode?: TargetModeType): Relationship {
|
||||||
const relationship = new Relationship(`rId${id}`, type, target);
|
const relationship = new Relationship(`rId${id}`, type, target, targetMode);
|
||||||
this.addRelationship(relationship);
|
this.addRelationship(relationship);
|
||||||
|
|
||||||
return relationship;
|
return relationship;
|
||||||
|
Reference in New Issue
Block a user