同时拥有自定义功能和任务面板

Have custom functions and a task pane at the same time

我正在关注 this link 以尝试自定义功能。以下清单确实启用了自定义功能:

<?xml version="1.0" encoding="utf-8"?>
<OfficeApp xmlns="http://schemas.microsoft.com/office/appforoffice/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0" xmlns:ov="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="TaskPaneApp">
  <Id>a124c024-2ae8-4d1a-bb00-7ff68c6fb738</Id>
  <!-- Generate a new guid for your Id element -->
  <Version>1.0.0.0</Version>
  <ProviderName>Contoso</ProviderName>
  <DefaultLocale>en-US</DefaultLocale>
  <DisplayName DefaultValue="Custom functions sample" />
  <Description DefaultValue="A variety of sample custom functions." />
  <Hosts>
    <Host Name="Workbook" />
  </Hosts>
  <DefaultSettings>
    <SourceLocation DefaultValue="https://www.myweb.com/customfunctions.html"/>
  </DefaultSettings>
  <Permissions>ReadWriteDocument</Permissions>
  <VersionOverrides xmlns="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="VersionOverridesV1_0">
    <Hosts>
      <Host xsi:type="Workbook">
        <AllFormFactors>
          <ExtensionPoint xsi:type="CustomFunctions">
            <Script>
              <SourceLocation resid="functionsjs" />
            </Script>
            <Page>
              <SourceLocation resid="functionshtml"/>
            </Page>
          </ExtensionPoint>
        </AllFormFactors>
      </Host>
    </Hosts>
    <Resources>
      <bt:Urls>
        <bt:Url id="functionsjs" DefaultValue="https://www.myweb.com/customfunctions.js" />
        <bt:Url id="functionshtml" DefaultValue="https://www.myweb.com/customfunctions.html" />
      </bt:Urls>
    </Resources>
  </VersionOverrides>
</OfficeApp>

现在,我想知道是否可以同时拥有自定义功能和任务窗格。所以我在https://www.myweb.com/customfunctions.html中添加了<body>this is the body</body>。但是,重新加载加载项不会显示任务窗格。

谁能告诉我是否可以同时拥有自定义功能和任务面板?我应该修改什么才能启用此功能?

编辑 1:xsi:type="VersionOverridesV1_0" 更改为 xsi:type="TaskPaneApp" 确实打开了任务窗格,但是当我们尝试自定义函数时,出现错误“我们可以” t start this add-in because it isn't set up properly”引发。

所以我还在寻找合适的解决方案。

是的,通过使用加载项命令,您可以在同一个加载项中同时拥有自定义功能和任务窗格。

要启用任务窗格命令,请在清单中使用 ShowTaskpane 操作(请参阅 help topic, like in this sample manifest on GitHub)。

如果您还希望每次插入任务窗格时都显示为 "permanent",请使用 this topic page 自动打开任务窗格。

-Michael(自定义功能的 PM)