0

I am making great progress developing my first word add-in (using the office Javascript API). One goal I have is to be able to, from a website, collect a few values, and then launch word, including the add-in, passing in the collected values as parameters, which I can then retrieve inside the add-in.

If needed, I can see how to reduce my params down to one, such as a SessionID; store all the parameters to a DB, using SessionID as the key, then pass the SessionID in, and retrieve the remaining values from the DB... But still can't figure out how to pass even the single parameter in. And am I passing it in to Word? Or into the add-in? or...?

Can anyone provide insight and examples how I might do this? So I need two pieces:

  1. How to launch Word, including my add-in task pane, and pass the parameter(s) to it?
  2. How, within the add-in, to obtain the parameter value, which I can then use as I need.

Thanks

Mark Jeweler
  • 69
  • 1
  • 7
  • If your Add-In is creating a document, that document can store document variables, which are strings, that can be retrieved. – Charles Kenyon Feb 23 '23 at 00:31

1 Answers1

1

There is no way to launch Word from your Office add-in. This is a potential security hole. The Office JavaScript API doesn't provide anything for that. Note, you can post or vote for an existing feature request on Tech Community where they are considered when the Office dev team goes through the planning process.

The Persist add-in state and settings article describes all possible ways of storing data in Office add-ins. You can choose one which suits your needs best.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45
  • Thanks, Eugene. I realized from your post that my wording caused confusion, so I have edited my question to clarify my need and intent. I am not trying to launch anything from my Office add-in. I am trying to launch Word and my Office add-in from an external web app, and pass a parameter from the web app, which I can then obtain the value of that parameter inside the add-in. – Mark Jeweler Feb 23 '23 at 12:27
  • Anyway, that is not possible. – Eugene Astafiev Feb 23 '23 at 14:04
  • Thanks, Eugene. I assume you mean that the parameter passing is the part that is not possible? I have figured out how to do the launching itself (i.e., open Word, with a blank document, and have my add-in active). – Mark Jeweler Feb 24 '23 at 15:30