Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can Ribbon button ExecuteAction post a message to TaskPane

Tags:

office-js

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

like image 335
Cloud Xu Avatar asked Feb 22 '26 16:02

Cloud Xu


2 Answers

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)
like image 149
Michael Saunders Avatar answered Feb 27 '26 10:02

Michael Saunders


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.

like image 26
Humberto Lezama Avatar answered Feb 27 '26 09:02

Humberto Lezama