Return to the
Open XML SDK for JavaScript
Developer Center
Creates a zipped package of all parts of the document, and then serializes the zip file to a base64 string.



Return Value

    Returns a string that contains a base64 encoded zip file that you can, for example, save to a local drive.


    var doc = new openXml.OpenXmlPackage(flatOpc);
    var b64string = doc.saveToBase64();


// This example converts a Flat OPC document to a DOCX.
// Open the document from Flat OPC XML.
var doc = new openXml.OpenXmlPackage(withComments_flatOpc);
// Save the document to base64 encoded ascii.
var base64doc = doc.saveToBase64();
return {
    returnedDocument: base64doc,
    defaultDocumentName: "WithComments.docx",
    output: "Click the 'Save' button to save the DOCX to a local drive.  If you do not see a 'Save' button, you do not have Flash available, and can't save the document."