Excel 2016 命令加载项只能在 Excel 在线上正常运行
Excel 2016 command add-in only working properly on Excel Online
我编写了一个 Excel 2016 taskpane 加载项,它可以在线和桌面上完美运行。然而,现在我正试图将它转换成一个命令加载项,我偶然发现了一个关于这个 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 在线进行测试,并在功能区上显示预期的命令组。但是,它无法在 Excel 的桌面版本中导入,因为在单击 'Insert'=>'My Addins'=>'Shared folder'(我在这里出于测试目的存储清单),据我目前的理解,这是由于某种验证失败造成的。
经过长时间的反复试验,我很确定 xml 命名空间和模式定义是罪魁祸首。然而,我仍在挣扎。
我已经检查过,如果我将 <VersionOverrides>
更改为 <VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides/1.0">
(请注意额外的尾随 /1.0
),那么我可以在线和桌面上部署清单,但随后他们两者都回退到任务窗格版本(据我所知,这是由于 <VersionOverrides>
部分由于格式错误而被省略的事实。
在类似的 中,问题在于命名空间的声明未完成,接受的答案选择使用 <OfficeApp xmlns:mailappor="http://schemas.microsoft.com/office/mailappversionoverrides/1.0>
(注意额外的 /1.0) and
`。当使用此配置,我可以让加载项按预期在线工作(命令加载项),但甚至无法在桌面上加载。
同样,我确定这不是版本问题,因此这个不适用,因为我是运行Version: 16.0.7070.2033
,理论上符合要求。
正如我所说,我真的很想弄清楚如何解决这个问题。因此,我们将不胜感激任何帮助(我太累了,可能遗漏了一些明显的东西)。谢谢
id
属性的使用长度似乎有限制。坚持使用 32 个字符的字符串解决了我的问题。
我编写了一个 Excel 2016 taskpane 加载项,它可以在线和桌面上完美运行。然而,现在我正试图将它转换成一个命令加载项,我偶然发现了一个关于这个 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 在线进行测试,并在功能区上显示预期的命令组。但是,它无法在 Excel 的桌面版本中导入,因为在单击 'Insert'=>'My Addins'=>'Shared folder'(我在这里出于测试目的存储清单),据我目前的理解,这是由于某种验证失败造成的。
经过长时间的反复试验,我很确定 xml 命名空间和模式定义是罪魁祸首。然而,我仍在挣扎。
我已经检查过,如果我将 <VersionOverrides>
更改为 <VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides/1.0">
(请注意额外的尾随 /1.0
),那么我可以在线和桌面上部署清单,但随后他们两者都回退到任务窗格版本(据我所知,这是由于 <VersionOverrides>
部分由于格式错误而被省略的事实。
在类似的 <OfficeApp xmlns:mailappor="http://schemas.microsoft.com/office/mailappversionoverrides/1.0>
(注意额外的 /1.0) and
`。当使用此配置,我可以让加载项按预期在线工作(命令加载项),但甚至无法在桌面上加载。
同样,我确定这不是版本问题,因此这个Version: 16.0.7070.2033
,理论上符合要求。
正如我所说,我真的很想弄清楚如何解决这个问题。因此,我们将不胜感激任何帮助(我太累了,可能遗漏了一些明显的东西)。谢谢
id
属性的使用长度似乎有限制。坚持使用 32 个字符的字符串解决了我的问题。