Excel 2016命令加载项仅在Excel Online上正常工作

时间:2016-08-04 19:01:31

标签: excel ms-office office365 office-addins office-js

我有一个Excel 2016任务窗口加载项,可以在线和桌面上完美运行。但是,现在我正在尝试将其转换为命令加载项,我遇到了一个关于这个manifest的非常奇怪的部署问题:

<?xml version="1.0" encoding="UTF-8"?>
<!--Created:325c27b6-9566-4641-a1c6-175f0039f620-->
<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" 
>
  <!--BasicSettings-->
  <Id>bcb30953-453a-4cbb-93c3-f3d289de0ee3</Id>
  <Version>1.1.5.6</Version>
  <ProviderName>My Corporation</ProviderName>
  <DefaultLocale>en-US</DefaultLocale>
  <DisplayName DefaultValue="MyAddin" />
  <Description DefaultValue="My addin's description"/>
  <IconUrl DefaultValue="https://i.imgur.com/MPuvMiq.png" />
  <HighResolutionIconUrl DefaultValue="https://i.imgur.com/MPuvMiq.png" />
  <SupportUrl DefaultValue="https://google.com" />
  <!-- http://dev.office.com/reference/add-ins/office-add-in-requirement-sets -->
  <Permissions>ReadWriteDocument</Permissions>
  <!--EndBasicSettings-->



  <!--BeginTaskpaneMode-->
  <Hosts>
    <Host Name="Workbook" />
  </Hosts>
  <DefaultSettings>
    <SourceLocation DefaultValue="https://odsample.azurewebsites.net/Pages/Home.aspx" />
  </DefaultSettings>
  <!--EndTaskpaneMode-->



  <!--BeginAddinCommandsMode-->
  <!-- https://github.com/OfficeDev/Office-Add-in-Commands-Samples/blob/master/Tools/XSD/TaskPaneAppVersionOverridesV1_0.xsd -->
  <VersionOverrides xmlns="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="VersionOverridesV1_0">
    <Description resid="MyAddin.Description" />
    <Hosts>
      <Host xsi:type="Workbook">
        <DesktopFormFactor>
          <GetStarted>
            <Title resid="MyAddin.Title"/>                  
            <Description resid="MyAddin.Description"/>              
            <LearnMoreUrl resid="MyAddin.LearnMore"/>
          </GetStarted>
          <FunctionFile resid="MyAddin.FunctionFile" />
          <ExtensionPoint xsi:type="PrimaryCommandSurface">
            <CustomTab id="MyAddin" >
              <Group id="MyAddin.Tab1.Group1">
                <Label resid="MyAddin.Tab1.Group1.Label" />
                <Icon>
                  <bt:Image size="16" resid="MyAddin.Tab1.Group1.Icon.16" />
                  <bt:Image size="32" resid="MyAddin.Tab1.Group1.Icon.32" />
                  <bt:Image size="80" resid="MyAddin.Tab1.Group1.Icon.80" />
                </Icon>
                <Control xsi:type="Button" id="MyAddin.Tab1.Group1.RunFunctionButton">
                  <Label resid="MyAddin.Tab1.Group1.RunFunctionButton.Label" />
                  <Supertip>
                    <Title resid="MyAddin.Tab1.Group1.RunFunctionButton.Title" />
                    <Description resid="MyAddin.Tab1.Group1.RunFunctionButton.Description" />
                  </Supertip>
                  <Icon>
                    <bt:Image size="16" resid="MyAddin.Tab1.Group1.RunFunctionButton.Icon.16" />
                    <bt:Image size="32" resid="MyAddin.Tab1.Group1.RunFunctionButton.Icon.32" />
                    <bt:Image size="80" resid="MyAddin.Tab1.Group1.RunFunctionButton.Icon.80" />
                  </Icon>
                  <Action xsi:type="ExecuteFunction">
                    <FunctionName>writeText</FunctionName>
                  </Action>
                </Control>
              </Group>
              <Label resid="MyAddin.Tab1.Label"/><!-- order is important-->
            </CustomTab>
          </ExtensionPoint>
        </DesktopFormFactor>
      </Host>
    </Hosts>
    <Resources>
      <bt:Images>
        <bt:Image id="MyAddin.Tab1.Group1.Icon.16" DefaultValue="https://i.imgur.com/FkSShX9.png" />
        <bt:Image id="MyAddin.Tab1.Group1.Icon.32" DefaultValue="https://i.imgur.com/FkSShX9.png" />
        <bt:Image id="MyAddin.Tab1.Group1.Icon.80" DefaultValue="https://i.imgur.com/FkSShX9.png" />
        <bt:Image id="MyAddin.Tab1.Group1.RunFunctionButton.Icon.16" DefaultValue="https://i.imgur.com/qDujiX0.png" />
        <bt:Image id="MyAddin.Tab1.Group1.RunFunctionButton.Icon.32" DefaultValue="https://i.imgur.com/qDujiX0.png" />
        <bt:Image id="MyAddin.Tab1.Group1.RunFunctionButton.Icon.80" DefaultValue="https://i.imgur.com/qDujiX0.png" />
      </bt:Images>
      <bt:Urls>
        <bt:Url id="MyAddin.LearnMore" DefaultValue="https://commandsimple.azurewebsites.net/FunctionFile.html" />
        <bt:Url id="MyAddin.FunctionFile" DefaultValue="https://commandsimple.azurewebsites.net/FunctionFile.html" />
      </bt:Urls>
      <bt:ShortStrings>
        <bt:String id="MyAddin.Title" DefaultValue="MyAddin" />
        <bt:String id="MyAddin.Tab1.Label" DefaultValue="MyAddin" />
        <bt:String id="MyAddin.Tab1.Group1.Label" DefaultValue="Execute Function" />
        <bt:String id="MyAddin.Tab1.Group1.RunFunctionButton.Label" DefaultValue="Execute Function" />
        <bt:String id="MyAddin.Tab1.Group1.RunFunctionButton.Title" DefaultValue="Execute Function" />
      </bt:ShortStrings>
      <bt:LongStrings>
        <bt:String id="MyAddin.Description" DefaultValue="MyAddin's description" />
        <bt:String id="MyAddin.Tab1.Group1.RunFunctionButton.Description" DefaultValue="Click to Execute Function" />
      </bt:LongStrings>
    </Resources>
  </VersionOverrides>
  <!--EndAddinCommandsMode--> 
</OfficeApp>

,主要基于official command addin example。这个清单可以在Excel Online上完美导入进行测试,并在功能区上显示预期的命令组。但是,它无法在Excel的桌面版本中导入,因为在点击&#39;插入&#39; =&gt;&#39;我的插件&#39; =&gt;&#39后,根本没有添加插件;共享文件夹&#39; (我存储用于测试目的的清单),这在我目前的理解中是由于某种失败的验证。

经过长时间的反复试验,我非常确定xml名称空间和模式定义应该受到指责。但是,我仍在苦苦挣扎。

我已经检查过,如果我将<VersionOverrides>更改为<VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides/1.0">(请注意额外的跟踪/1.0),那么我可以在线和桌面上部署清单,但之后它们都会回退到任务窗口版本(据我所知,由于<VersionOverrides>部分由于畸形而被忽略。

在类似的question中,问题在于声明命名空间未完成,接受的答案选择使用<OfficeApp xmlns:mailappor="http://schemas.microsoft.com/office/mailappversionoverrides/1.0>(注意额外的/1.0) and`。使用此时配置,我让加载项在网上按预期工作(命令加载项),但甚至无法加载到桌面上。

同样,我确信这不是版本问题,因此question不适用,因为我正在运行Version: 16.0.7070.2033,理论上符合要求。

正如我所说,我真的很想弄清楚如何解决这个问题。所以,任何帮助都会被完全赞赏(我太累了,我可能会错过一些明显的东西)。感谢

1 个答案:

答案 0 :(得分:1)

似乎可以使用的[INNER] JOIN属性的长度有限制。坚持使用32个字符的字符串解决了我的问题。