Excel Custom TaskPane with WebBrowser control - Show/Hide with Ribbon Button

797 Views Asked by At

What is the best way to implement a web interface into the application level custom task pane using Visual Studio 2015 for Excel 2010 and 2013 and set taskpane visibility from a ribbon button?

  • I want to show/hide the custom task pane based on a ribbon button press.
  • The web interface will have search and return results from a database.
  • The web page will contain buttons, such that when pressed will place data into the Excel application.

Some thinking:

  1. Create a separate 'Task Pane Office AddIn' which creates the task pane using JavaScript and HTML. Subsequently, show/hide this task pane using a separate VSTO Excel Ribbon AddIn button?
  2. Inside the VSTO ribbon AddIn, embed a web interface control into the custom task pane (form or WPF) control? But (1) appears to be a much more robust solution? But I need the show task pane button working.
  3. Utilise the Microsoft JavaScript API in some way?
  4. Another method?

What I have done: I was able syncronise a VSTO Ribbon Excel Addin button to a custom taskpane that becomes visible and hidden that works in 2010 and 2013.

Using: https://msdn.microsoft.com/en-us/library/bb608590.aspx and CustomTaskPane in Excel doesn't appear in new Workbooks.

I also created a 'Task pane Office AddIn' in Excel using Visual Studio 2015.

Now, I would like to either synchronise a ribbon button to (1) or create a web interface using (2). Or be told/discuss the 'best way'?

1

There are 1 best solutions below

0
On

You need to create a seperate web application and host that in a server. Your web application should take a search querystring so that you can pass that search string from addin.

Then create your addin project with customtaskpane having webbrowser control. When the custom task pane is shown navigate to the url

browserControl1.Url ="https://www.google.co.uk/search?q=search%20in%20custom%20taskpane"