none
Including Web search results in Task Pane in Office App RRS feed

  • Question

  • Is it possible to include something like Google search results in a task pane in Office 2013 as a Office app(Visual Studio 2013)? We are looking to have a browser based functionality such that whatever text the user selects in the
    Word and hits a icon, the search results for the selected text from the browser can be displayed in the task pane.
    How can you implement this programatically? Please let me know how I can go about this.
    (Kindly note that I am looking to implement as a Office app so it can be published to Azure website)

    Thanks,

    Joshua

    Monday, September 14, 2015 5:23 AM

Answers

  • Hi Joshua,

    >> Is it possible to include something like Google search results in a task pane in Office 2013 as a Office app(Visual Studio 2013)?

    Yes, it is possible. You could use “Office.context.document.getSelectedDataAsync” to get the selected text, set the value of “window.open” with something like “https://www.google.com/?web+page+navigation+javascript#q=excel”. With this method, you need to the code below to yourtaskpane.xml of the manifest.

      <AppDomains>
        <AppDomain>https://www.google.com</AppDomain>
      </AppDomains>

    You could use the function in one button click event in your task pane.

        // Reads data from current document selection and displays a notification
        function getDataFromSelection() {
            Office.context.document.getSelectedDataAsync(Office.CoercionType.Text,
                function (result) {
                    if (result.status === Office.AsyncResultStatus.Succeeded) {
                        app.showNotification('The selected text is:', '"' + result.value + '"');
                        window.open("https://www.google.com/?web+page+navigation+javascript#q=" +result.value, "_self")
                    } else {
                        app.showNotification('Error:', result.error.message);
                    }
                }
            );
        }

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Tuesday, September 15, 2015 9:59 AM

All replies

  • Hi Joshua,

    >> Is it possible to include something like Google search results in a task pane in Office 2013 as a Office app(Visual Studio 2013)?

    Yes, it is possible. You could use “Office.context.document.getSelectedDataAsync” to get the selected text, set the value of “window.open” with something like “https://www.google.com/?web+page+navigation+javascript#q=excel”. With this method, you need to the code below to yourtaskpane.xml of the manifest.

      <AppDomains>
        <AppDomain>https://www.google.com</AppDomain>
      </AppDomains>

    You could use the function in one button click event in your task pane.

        // Reads data from current document selection and displays a notification
        function getDataFromSelection() {
            Office.context.document.getSelectedDataAsync(Office.CoercionType.Text,
                function (result) {
                    if (result.status === Office.AsyncResultStatus.Succeeded) {
                        app.showNotification('The selected text is:', '"' + result.value + '"');
                        window.open("https://www.google.com/?web+page+navigation+javascript#q=" +result.value, "_self")
                    } else {
                        app.showNotification('Error:', result.error.message);
                    }
                }
            );
        }

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Tuesday, September 15, 2015 9:59 AM
  • Thank you Edward for the response.
    Tuesday, September 15, 2015 11:44 AM
  • Hi Edward,

    Can the link in a document open inside the task pane programatically?

    For ex: "I am <<Google link>>, need to open in the task pane displaying the site Google.com"

    As per my requirement, we would like to open all links inside the task pane on the right hand side. The code above opens it in  a new browser window.

    Thanks again.

    Tuesday, September 22, 2015 11:56 AM
  • Hi Joshua,

    Did the reply work for you? If it did, I suggest you mark it as answer to close this thread. If not, please feel free to let us know.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Wednesday, September 23, 2015 7:05 AM
  • Hi Edward, 

    I am looking to embed the search results in a task pane and open links from document inside task pane. Unfortunately, this couldn't solve.Thanks, though!

    Monday, September 28, 2015 9:55 AM