
I found this at least myself https://learn.microsoft.com/en-us/office/client-developer/office-uri-schemes
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Is there a way to open existing document with Office JS API (Word, Excel, PowerPoint) as we can open new document with stream? If there is no API support, is there protocol URLs which we could use (in desktop/browser win/mac) to accomplish this?
Our use case is that we automate document saving process so that document is stored to predefined location. After this is done, we need to open this copy for user.
I found this at least myself https://learn.microsoft.com/en-us/office/client-developer/office-uri-schemes
Hi,
apparently there has been an update recently, which based on some code examples seen allows to open a document using the office JS API. See also the MIcrosoft documentation
createDocument(base64File)
Creates a new document by using an optional base64 encoded .docx file.
TypeScriptCopy
createDocument(base64File?: string): Word.DocumentCreated;
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); });
}
createDocument