OpenXmlPart.getPartById(relationshipId)

Return to the
Open XML SDK for JavaScript
Developer Center
Gets the part that is the target of the relationship with the specified relationship id.

Syntax

    var part = pkg.getPartById(relationshipId);

Arguments

    relationshipId: An string that contains the relationship id.

Return Value

    Returns an OpenXmlPart object. If there is no part related with the specified relationship id, this function returns null.

Usage

    var part = doc.getPartByRelationshipId("rId1");

Example

// Open a blank document that is stored as a base64 string.
var doc = new openXml.OpenXmlPackage(blankDocument_base64);
var part = doc.mainDocumentPart().getPartById("rId1");
if (part !== null) {
    o = "Found the part, uri = " + part.uri;
}
return { output: o };