{"id":2165,"date":"2016-02-04T06:16:19","date_gmt":"2016-02-04T06:16:19","guid":{"rendered":"http:\/\/www.ericwhite.com\/home2\/bm8qcmjy\/public_html\/blog\/?page_id=2165"},"modified":"2016-02-04T06:21:04","modified_gmt":"2016-02-04T06:21:04","slug":"openxmlpart-getrelationshipsbyrelationshiptype","status":"publish","type":"page","link":"https:\/\/www.ericwhite.com\/blog\/openxmlpart-getrelationshipsbyrelationshiptype\/","title":{"rendered":"OpenXmlPart.getRelationshipsByRelationshipType(relationshipType)"},"content":{"rendered":"<p><span class=\"Back\"><a class=\"Back\" href=\"https:\/\/www.ericwhite.com\/blog\/open-xml-sdk-for-javascript\/\">Return to the<br \/>Open XML SDK for JavaScript<br \/>Developer Center<\/a><\/span>Gets an array that contains all relationships with the specified relationship type.<\/p>\n<h1>Syntax<\/h1>\n<pre>\r\n    var relList = OpenXmlPart.getRelationshipsByRelationshipType(relationshipType)\r\n<\/pre>\n<h1>Return Value<\/h1>\n<pre>\r\n    Returns an array of OpenXmlRelationship objects that contains the relationships with the specified relationship type.\r\n<\/pre>\n<h1>Usage<\/h1>\n<pre>\r\n    var relList = pkg.mainDocumentPart()\r\n        .getRelationshipsByRelationshipType(openXml.relationshipTypes.styles);\r\n<\/pre>\n<h1>Example<\/h1>\n<pre>\r\n\/\/ Open a blank document that is stored as a base64 string.\r\nvar doc = new openXml.OpenXmlPackage(blankDocument_base64);\r\n\/\/ Get a list of all relationships with the specified relationship type.\r\nvar rels = doc.mainDocumentPart().getRelationshipsByRelationshipType(openXml.relationshipTypes.styles);\r\nvar o = [];\r\nfor (var i = 0; i < rels.length; i++) {\r\n    var rel = rels[i];\r\n    o.push(\"relationship id: \" + rel.relationshipId);\r\n    o.push(\"rel type: \" + rel.relationshipType);\r\n    o.push(\"target: \" + rel.target);\r\n    o.push(\"targetMode: \" + rel.targetMode);\r\n    o.push(\"targetFullName: \" + rel.targetFullName);\r\n    o.push(\"\");\r\n}\r\nreturn { output: o };\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Return to theOpen XML SDK for JavaScriptDeveloper 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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"_s2mail":"","footnotes":""},"class_list":["post-2165","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.ericwhite.com\/blog\/wp-json\/wp\/v2\/pages\/2165","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ericwhite.com\/blog\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.ericwhite.com\/blog\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.ericwhite.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ericwhite.com\/blog\/wp-json\/wp\/v2\/comments?post=2165"}],"version-history":[{"count":3,"href":"https:\/\/www.ericwhite.com\/blog\/wp-json\/wp\/v2\/pages\/2165\/revisions"}],"predecessor-version":[{"id":2172,"href":"https:\/\/www.ericwhite.com\/blog\/wp-json\/wp\/v2\/pages\/2165\/revisions\/2172"}],"wp:attachment":[{"href":"https:\/\/www.ericwhite.com\/blog\/wp-json\/wp\/v2\/media?parent=2165"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}