In an add-in im working on I've pulled Ooxml from an open document and i want to save that specific Ooxml to a new document.
Ive done the following to create a new document as Juan Balmori says in this SO post. How to open new word docx document in word add in
function onaddOpenDoc() {
Word.run(function (context) {
// this getDocumentAsBase64 assumes a valid base64-encoded docx file
var myNewDoc = context.application.createDocument(getDocumentAsBase64());
context.load(myNewDoc);
return context.sync()
.then(function () {
myNewDoc.open();
context.sync();
}).catch(function (myError) {
//otherwise we handle the exception here!
showNotification("Error", myError.message);
})
}).catch(function (myError) { showNotification("Error", myError.message); });
}
A new file is created and opened, but i cant interact with the new file. I've tried getting the myNewDoc.body and .insertOoxml() , but i get this message in the browser version.
Error The action isn’t supported by Word in a browser. Check the OfficeExtension.Error.debugInfo for more information.
The desktop version just opens a new file and does nothing.
My question boils down to, is there any way for me to interact with the body of a document that was created with context.application.createDocument() ?