Cloud Xu
Cloud Xu

Reputation: 3337

How can Ribbon button ExecuteAction post a message to TaskPane

We are working on a TaskPane Addin. And we are adding Addin Commands to it.

  1. We wants to achieve functionality that the ribbon button can trigger some UI in the TaskPane. (Like start a wizard) But we does not see a way to post a message from the invisible browser context ExecuteAction is running to the TaskPane window.

  2. Would ExecuteFunction check if TaskPane is opened or not?

  3. For performance concern, I would like to know how does ExecuteFunction loads invisible HTML page. Is the HTML page loaded once in an open session of Excel? Versus loaded every time a ExecuteFunction is executed?

Thanks

Upvotes: 3

Views: 381

Answers (2)

Michael Saunders
Michael Saunders

Reputation: 2668

Here are some ways you can try to communicate from the ExecuteFunction to the task pane:

  • LocalStorage events (though it may not work on all browsers/platforms)
  • Cookies (no event, but you could poll for changes)
  • Office.context.document.Settings
  • Calls to/from a web server (slower perf, but this method is guaranteed to work in every situation)

Upvotes: 2

Humberto Lezama
Humberto Lezama

Reputation: 586

To display a pane from a command you must use the ShowTaskpane action; you cannot trigger a pane from an ExecuteFunction action. If you need to display UI from ExecuteFunction the only API available right now is displayDialog.

Every time ExecuteFunction is called a new instance of the page is loaded but if the page is cacheable then load times are actually pretty fast.

Upvotes: 1

Related Questions