I'm developing an add-in for Microsoft Word 2016 using office js version 16.0.8626.1000. I use a web service to retrieve a document in base64 format and then I create a new Word instance with that.
The problem is that whenever I run the add-in from my server (not from visual studio debugger) it opens the document but the add-in frame displays an error
This doesn't happen if I run the add-in from visual studio debugger, it opens the new instance without the frame.
This is my code
Office.initialize = function (reason) {
// Checks for the DOM to load using the jQuery ready function.
$(document).ready(function () {
$('#get').click(function () {
openWord();
});
});
}
This how I retrieve the document (without real url):
function openWord() {
getDocumentAsBase64(function (data) {
Word.run(function (context) {
var myNewDoc = context.application.createDocument(data);
context.load(myNewDoc);
return context.sync()
.then(function () {
myNewDoc.open();
context.sync();
})
.catch(function (myError) {
//otherwise we handle the exception here!
updateStatus(myError.message);
})
}).catch(function (myError) {
updateStatus(myError.message);
});
});
}
function getDocumentAsBase64(callback) {
$.ajax({
url: 'http://myurltomydocument.com/getFile',
data: "{}",
dataType: "json",
type: "POST",
contentType: "application/json; charset=utf-8",
success: function (response) {
callback(response.d);
},
error: function (response) {
updateStatus(response.d);
}
});
}
EDIT -- 8/12/2017
This is the manifest that I'm currently using if anyone wants to replicate the problem with Office 2016