new openXml.OpenXmlPackage(flatOpc)
Return to the
Open XML SDK for JavaScript
Developer CenterCreates a new instance of an OpenXmlPackage object from the specified flatOpc XML. Use the new operator to create this object. See The Flat Opc Format for more information.
Syntax
new openXml.OpenXmlPackage(flatOpcString);
Arguments
flatOpcString: A string that contains an Open XML document stored in Flat Opc format.
Return Value
Returns the document, ready to be modified.
Usage
var doc = new openXml.OpenXmlPackage(document);
Example
// Open a document that is stored as Flat Opc XML. // The document contains some comments. var doc = new openXml.OpenXmlPackage(withComments_flatOpc); // 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. doc.mainDocumentPart() .getXDocument() .descendants(W.p) .firstOrDefault() .replaceWith(p); return { returnedDocument: doc.saveToFlatOpc(), defaultDocumentName: "OpenXmlDocument.xml", 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." };