OpenXmlPart.getRelationshipsByRelationshipType(relationshipType)
Return to the
Open XML SDK for JavaScript
Developer CenterGets an array that contains all relationships with the specified relationship type.
Syntax
var relList = OpenXmlPart.getRelationshipsByRelationshipType(relationshipType)
Return Value
Returns an array of OpenXmlRelationship objects that contains the relationships with the specified relationship type.
Usage
var relList = pkg.mainDocumentPart() .getRelationshipsByRelationshipType(openXml.relationshipTypes.styles);
Example
// Open a blank document that is stored as a base64 string. var doc = new openXml.OpenXmlPackage(blankDocument_base64); // Get a list of all relationships with the specified relationship type. var rels = doc.mainDocumentPart().getRelationshipsByRelationshipType(openXml.relationshipTypes.styles); var o = []; for (var i = 0; i < rels.length; i++) { var rel = rels[i]; o.push("relationship id: " + rel.relationshipId); o.push("rel type: " + rel.relationshipType); o.push("target: " + rel.target); o.push("targetMode: " + rel.targetMode); o.push("targetFullName: " + rel.targetFullName); o.push(""); } return { output: o };