问题
Is it possible to have a VSTO add-in and a JS/HTML based Task Pane app talk to each other when running inside desktop Office application?
The goal would be to bridge capabilities not yet present (or never will be present) in the x-platform Office APIs using VSTO.
回答1:
As Evgene mentioned, there is no out-of-the-box functionality for this (though the topic has certainly come up in internal discussions, so I would be very curious to hear your scenario, and particularly how you would handle the VSTO-only-on-the-desktop case).
If you wanted to try this now, you probably still could with a bit of a creative solution. Imagine you have a hidden sheet with a named range on it, which you use as a communication buffer between VSTO and your taskpane app.
For VSTO => JS communication: have the taskpane create a binding over the named range, then use the binding-data-changed event to listen to an incoming message from your VSTO add-in.
For JS => VSTO communication: have the JS set data to the binding (which, as above, was created over the named range). On the VSTO side, listen to data changed event, intersect the incoming range with the named range's range, and if the intersection is not null, fetch the text to get the incoming message.
If you do end up trying out this approach, do keep the thread posted on how it went -- I'd be quite curious to hear.
~ Michael Zlatkovsky (developer on Office Extensibility team)
回答2:
Need to admit that VSTO based add-ins can be run only on Windows and desktop clients. Other platforms can't be supported with such scenario.
Anyway, VSTO nor Mail Apps (JS/HTML) don't provide anything for that out of the box.
来源:https://stackoverflow.com/questions/33330872/two-way-communication-between-vsto-add-in-and-a-task-pane-app-js-html