How to open a document in 'current window' in office add-in instead of opening in a new window?

Hi,


I'm working on Office 365 Word Add-in that opens a document.

When we open the document via context.application.createDocument(base64string).open(), it launches a new window instead of opening the document in current browser tab (in case of web Add-in) or current instance of word (in case of windows Add-in).

Here is my use case:

  1. Check if there is already an open document and ask the user to save or lose changes.

  2. Have an API to close the current open document e.g. context.document.close();

  3. Open a new document via context.application.createDocument(base64string).open(), so that the document is opened in the current window instead of opening in a new instance of word.

Is there any workaround to open the document in the current instance of word (in case of desktop app) and in the same browser tab in case of word online?

Cross posted here.

Thanks.

 

Question Info


Last updated January 23, 2024 Views 120 Applies to: