1
votes

I am working on word Addin. My host application is one asp.net website from which I shall open word document and word addin will sideload there. My requirement is after I open document I should be able to read all the sections in the document and then pass the section names in host application and open a new tab/popup in the host application with the data I have read.

I am able to read sections and I can open a pop up using dialog api but I want to pass the context and data to host website instead of opening a stand alone popup using dialog api.

Is there any way we can pass data and context from word document to host application using office js?

1
In discussions of Office Add-ins, "host application" normally means the Office application (Excel, Word, Outlook, etc.). I don't think you are using it in that way. Can you clarify what you mean by "host application"? Also, could you share the code that you've tried?Rick Kirkham
@RickKirkham We have a .Net website from where we can open word document. That is our host application. AddIn will be installed locally in each desktop so when we open word from our .Net website the addin will sideload. Our query is by any chance can we pass context of our application to AddIn and from the AddIn can we pass context to the application from which we are opening word?Common_Coder

1 Answers

1
votes

You can pass any information you want from add-in to another web application if it exposes a web API, so the answer to "from the AddIn can we pass context to the application from which we are opening word" is yes.

To pass information to the add-in from what you are calling the host web application, I think you have two options.

  1. Have logic in the add-in, that runs as soon as it has loaded, that calls out to the web app to fetch the context data.

  2. The web app uses the Open XML SDK 2.5 for Office to add context information, as custom XML parts or custom properties, to the document before it opens the document for the user. Have logic in the add-in, that runs as soon as it has loaded, that reads this custom XML or custom properties.