How to show an Office/Word 2013 Task Pane 'Off

2019-05-27 04:46发布

问题:

I've created a Task Pane App with the new Office App model. It uses JQuery and a REST Service to search and display data from SharePoint in the (Word 2013) Task Pane. This works ok, however the App Task Pane should be activated after clicking on a custom button in the ribbon.

To create the button, I've created a Word 2013 Addin project with following Custom UI XML:

    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
      <ribbon>
        <tabs>
          <tab idMso="TabHome">
            <group id="ContentGroup" label="SharePoint App">
              <button id="spAppButton" label="SharePoint App" imageMso="FunctionsLookupReferenceInsertGallery" size="large" onAction="OnAppButton"/>
            </group>
          </tab>
        </tabs>
      </ribbon>
    </customUI>

In the callback method I have access to the Microsoft.Office.Interop.Word.Application Application Object:

    public void OnAppButton(Office.IRibbonControl control)
    {

    Globals.ThisAddIn.Application ...

However I cannot figure out how i can possibly activate the Office App using this Api.

I've tried for example to enumerate the Commandbars and Commands, but I cannot find any command which is related to Apps for Office.

I can add a custom Taskpane and display it, however that does not display the Office App. If I'm not mistaken, going down that road would mean developing the app from scratch as a 'traditional' C# Word Addin. I would like to use the new Office App Model however and show the App I've created already in the task pane.

Does anyone have an idea how this would be possible to achieve (showing the (JQuery/HTML) Office Task Pane App from the OnAppButton callback method)?

More information regarding 'Apps for Office' is available here: https://msdn.microsoft.com/en-us/library/office/jj220060.aspx

Thank you very much, I've tried to figure this out for some time now, but I'm not making any progress.

回答1:

The Office extensibility model doesn't provide anything for running Office Apps programmatically.