【问题标题】:Have custom functions and a task pane at the same time同时拥有自定义功能和任务窗格
【发布时间】:2017-12-27 18:36:33
【问题描述】:

我正在关注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 中添加了&lt;body&gt;this is the body&lt;/body&gt;。但是,重新加载加载项不会显示任务窗格。

谁能告诉我是否可以同时拥有自定义功能和任务窗格?我应该修改什么来启用它?

编辑 1:xsi:type="VersionOverridesV1_0" 更改为 xsi:type="TaskPaneApp" 确实会打开任务窗格,但是当我们尝试自定义功能时,会出现错误“我们无法启动此加载项,因为它不是引发了“未正确设置”。

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

【问题讨论】:

    标签: ms-office office-js custom-functions-excel


    【解决方案1】:

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

    要启用任务窗格命令,请在清单中使用ShowTaskpane 操作(请参阅help topic,就像在此sample manifest on GitHub 中一样)。

    如果您还希望任务窗格在插入时保持“永久”状态,请在自动打开任务窗格时使用 this topic page

    -Michael(自定义函数的 PM)

    【讨论】:

    • 你好迈克尔,你对this question有什么想法吗?干杯
    • 如果我们想将自定义函数和任务窗格配置放在同一个插件中并从同一个 html 和 js 文件中控制它们,它们将如何出现在清单中?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-01
    相关资源
    最近更新 更多