{"id":2062,"date":"2016-02-04T03:42:40","date_gmt":"2016-02-04T03:42:40","guid":{"rendered":"http:\/\/www.ericwhite.com\/home2\/bm8qcmjy\/public_html\/blog\/?page_id=2062"},"modified":"2016-02-04T03:47:34","modified_gmt":"2016-02-04T03:47:34","slug":"openxmlpackage_flatopc","status":"publish","type":"page","link":"https:\/\/www.ericwhite.com\/blog\/openxmlpackage_flatopc\/","title":{"rendered":"new openXml.OpenXmlPackage(flatOpc)"},"content":{"rendered":"<p><span class=\"Back\"><a class=\"Back\" href=\"https:\/\/www.ericwhite.com\/blog\/open-xml-sdk-for-javascript\/\">Return to the<br \/>Open XML SDK for JavaScript<br \/>Developer Center<\/a><\/span>Creates 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.<\/p>\n<h1>Syntax<\/h1>\n<pre>\r\n    new openXml.OpenXmlPackage(flatOpcString);\r\n<\/pre>\n<h1>Arguments<\/h1>\n<pre>\r\n    flatOpcString: A string that contains an Open XML document stored in Flat Opc format.\r\n<\/pre>\n<h1>Return Value<\/h1>\n<p>Returns the document, ready to be modified.<\/p>\n<h1>Usage<\/h1>\n<pre>\r\n    var doc = new openXml.OpenXmlPackage(document);\r\n<\/pre>\n<h1>Example<\/h1>\n<pre>\r\n\/\/ Open a document that is stored as Flat Opc XML.\r\n\/\/ The document contains some comments.\r\nvar doc = new openXml.OpenXmlPackage(withComments_flatOpc);\r\n\/\/ Create a paragraph.\r\nvar p = new XElement(W.p,\r\n    new XElement(W.r,\r\n        new XElement(W.t, \"Hello Open XML World\")));\r\n\/\/ Replace the first paragraph in the document with the new paragraph.\r\ndoc.mainDocumentPart()\r\n    .getXDocument()\r\n    .descendants(W.p)\r\n    .firstOrDefault()\r\n    .replaceWith(p);\r\nreturn {\r\n    returnedDocument: doc.saveToFlatOpc(),\r\n    defaultDocumentName: \"OpenXmlDocument.xml\",\r\n    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.\"\r\n};\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Return to theOpen XML SDK for JavaScriptDeveloper 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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"_s2mail":"","footnotes":""},"class_list":["post-2062","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.ericwhite.com\/blog\/wp-json\/wp\/v2\/pages\/2062","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ericwhite.com\/blog\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.ericwhite.com\/blog\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.ericwhite.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ericwhite.com\/blog\/wp-json\/wp\/v2\/comments?post=2062"}],"version-history":[{"count":1,"href":"https:\/\/www.ericwhite.com\/blog\/wp-json\/wp\/v2\/pages\/2062\/revisions"}],"predecessor-version":[{"id":2063,"href":"https:\/\/www.ericwhite.com\/blog\/wp-json\/wp\/v2\/pages\/2062\/revisions\/2063"}],"wp:attachment":[{"href":"https:\/\/www.ericwhite.com\/blog\/wp-json\/wp\/v2\/media?parent=2062"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}