OpenXmlPart.getRelationshipsByContentType (contentType)
Return to the
Open XML SDK for JavaScript
Developer CenterGets an array that contains all relationships that target parts with the specified content type.
Syntax
var relList = OpenXmlPart.getRelationshipsByContentType(contentType)
Return Value
Returns an array of OpenXmlRelationship objects that contains the relationships from the document to various parts with the specified content type.
Usage
var relList = pkg.mainDocumentPart().getRelationshipsByContentType(openXml.contentTypes.header);
Example
// Open a blank document that is stored as a base64 string. var doc = new openXml.OpenXmlPackage(documentWithHeaders_base64); // Get a list of all parts in the document and list them in the output text area. var rels = doc.mainDocumentPart().getRelationshipsByContentType(openXml.contentTypes.header); 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 };