OpenXmlPackage.getContentType(uri)

Return to the
Open XML SDK for JavaScript
Developer Center
Gets the content type of a part at the specified uri.

Syntax

    var contentType = OpenXmlPackage.getContentType(uri);

Arguments

    uri: An string that contains the uri of the part for which you want to get the content type.

Return Value

    Returns a string that contains the content type of the part. If there is no part at the specified uri, this function returns null.

Usage

    var contentType = OpenXmlPackage.getContentType("\word\document.xml");

Example

// Open a blank document that is stored as a base64 string.
var doc = new openXml.OpenXmlPackage(blankDocument_base64);

// Get the content type of the main document part.
var contentType = doc.getContentType("/word/document.xml");
o = ["Content type of the main document part:", contentType];

return { output: o };