new openXml.OpenXmlPackage(base64)

Return to the
Open XML SDK for JavaScript
Developer Center
Creates a new instance of an OpenXmlPackage object from the specified base64 string. Use the new operator to create this object.


    new openXml.OpenXmlPackage(base64String);


    base64String: Binary DOCX encoded as a base64 string.

Return Value

    Returns the document, ready to be modified.


    var doc = new openXml.OpenXmlPackage(document);


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

// Create a paragraph.
var p = new XElement(W.p,
    new XElement(W.r,
        new XElement(W.t, "Hello Open XML World")));

// Replace the first paragraph in the document with the new paragraph.

return {
    returnedDocument: doc.saveToBase64(),
    defaultDocumentName: "OpenXmlDocument.docx",
    output: "Click the 'Save' button to save the modified document to a local drive.  If you do not see a 'Save' button, you do not have Flash available, and can't save the document."