CustomTab 使加载项崩溃
我正在尝试 Excel 加载项,并尝试使用自定义功能区来组织我想要在组织内部署的不同功能。我一直在关注一个有效的教程项目,试图改变一些逻辑。现在我想将我的函数放在自定义选项卡中以保持概览和轻松访问。当我尝试在清单中更改该设置时,运行加载项代码时,Excel 中总是会出现错误,而无需任何进一步的说明,请参见图片:
我目前的清单如下:
<?xml version="1.0" encoding="UTF-8"?>
<!--Created:ce44715c-8c4e-446b-879c-ea9ebe0f09c8-->
<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">
<!-- Begin Basic Settings: Add-in metadata, used for all versions of Office unless override provided. -->
<!-- IMPORTANT! Id must be unique for your add-in, if you reuse this manifest ensure that you change this id to a new GUID. -->
<Id>8da524bf-5dac-4b65-9194-0347541b9c11</Id>
<!--Version. Updates from the store only get triggered if there is a version change. -->
<Version>1.0.0.0</Version>
<ProviderName>[Provider name]</ProviderName>
<DefaultLocale>en-US</DefaultLocale>
<!-- The display name of your add-in. Used on the store and various places of the Office UI such as the add-ins dialog. -->
<DisplayName DefaultValue="HBUrenverwerking" />
<Description DefaultValue="HBUrenverwerking"/>
<!-- Icon for your add-in. Used on installation screens and the add-ins dialog. -->
<IconUrl DefaultValue="~remoteAppUrl/Images/Button32x32.png" />
<SupportUrl DefaultValue="http://www.contoso.com" />
<!-- Domains that will be allowed when navigating. For example, if you use ShowTaskpane and then have an href link, navigation will only be allowed if the domain is on this list. -->
<AppDomains>
<AppDomain>AppDomain1</AppDomain>
<AppDomain>AppDomain2</AppDomain>
<AppDomain>AppDomain3</AppDomain>
</AppDomains>
<!--End Basic Settings. -->
<!--Begin TaskPane Mode integration. This section is used if there are no VersionOverrides or if the Office client version does not support add-in commands. -->
<Hosts>
<Host Name="Workbook" />
</Hosts>
<DefaultSettings>
<SourceLocation DefaultValue="~remoteAppUrl/Home.html" />
</DefaultSettings>
<!-- End TaskPane Mode integration. -->
<Permissions>ReadWriteDocument</Permissions>
<!-- Begin Add-in Commands Mode integration. -->
<VersionOverrides xmlns="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="VersionOverridesV1_0">
<!-- The Hosts node is required. -->
<Hosts>
<!-- Each host can have a different set of commands. -->
<!-- Excel host is Workbook, Word host is Document, and PowerPoint host is Presentation. -->
<!-- Make sure the hosts you override match the hosts declared in the top section of the manifest. -->
<Host xsi:type="Workbook">
<!-- Form factor. Currently only DesktopFormFactor is supported. -->
<DesktopFormFactor>
<!--"This code enables a customizable message to be displayed when the add-in is loaded successfully upon individual install."-->
<GetStarted>
<!-- Title of the Getting Started callout. The resid attribute points to a ShortString resource -->
<Title resid="Contoso.GetStarted.Title"/>
<!-- Description of the Getting Started callout. resid points to a LongString resource -->
<Description resid="Contoso.GetStarted.Description"/>
<!-- Points to a URL resource which details how the add-in should be used. -->
<LearnMoreUrl resid="Contoso.GetStarted.LearnMoreUrl"/>
</GetStarted>
<!-- Function file is a HTML page that includes the JavaScript where functions for ExecuteAction will be called.
Think of the FunctionFile as the code behind ExecuteFunction. -->
<FunctionFile resid="Urentaken.HubbaseInternFFUrl" />
<!-- PrimaryCommandSurface is the main Office Ribbon. -->
<ExtensionPoint xsi:type="PrimaryCommandSurface">
<!-- Speciale tab voor automatiseren taken hubbase. -->
<CustomTab id="Hubbase.HubbaseIntern">
<!-- Groep met betrekking tot het verweken van gemaakte uren en doorsturen naar klanten van Hubbase -->
<Group id="Hubbase.HubbaseIntern.Urentaken">
<Label resid="Urentaken.GroupUrenverwerkingLbl" />
<Icon>
<bt:Image size="16" resid="Contoso.tpicon_16x16" />
<bt:Image size="32" resid="Contoso.tpicon_32x32" />
<bt:Image size="80" resid="Contoso.tpicon_80x80" />
</Icon>
<Control xsi:type="Button" id="Hubbase.HubbaseIntern.Urentaken.FormateerUren">
<Label resid="Urentaken.ButtonFormatUrenLbl" />
<Supertip>
<Title resid="Urentaken.ButtonFormatUrenTitle"/>
<Description resid="Urentaken.ButtonFormatUrenDesc"/>
</Supertip>
<Icon>
<bt:Image size="16" resid="Contoso.tpicon_16x16" />
<bt:Image size="32" resid="Contoso.tpicon_32x32" />
<bt:Image size="80" resid="Contoso.tpicon_80x80" />
</Icon>
<Action xsi:type="ExecuteFunction">
<FunctionName>formatUren</FunctionName>
</Action>
</Control>
<!-- <Control xsi:type="Button" id="Hubbase.HubbaseIntern.Urentaken.FormateerUren"> -->
</Group>
<!-- <Group id="Hubbase.HubbaseIntern.Urentaken"> -->
<Label resid="HubbaseIntern.CustomTabLbl" />
</CustomTab>
<!-- <CustomTab id="Hubbase.HubbaseIntern"> -->
</ExtensionPoint>
</DesktopFormFactor>
</Host>
</Hosts>
<!-- You can use resources across hosts and form factors. -->
<Resources>
<bt:Images>
<bt:Image id="Contoso.tpicon_16x16" DefaultValue="~remoteAppUrl/Images/Button16x16.png" />
<bt:Image id="Contoso.tpicon_32x32" DefaultValue="~remoteAppUrl/Images/Button32x32.png" />
<bt:Image id="Contoso.tpicon_80x80" DefaultValue="~remoteAppUrl/Images/Button80x80.png" />
</bt:Images>
<bt:Urls>
<bt:Url id="Contoso.DesktopFunctionFile.Url" DefaultValue="~remoteAppUrl/Functions/FunctionFile.html" />
<bt:Url id="Contoso.Taskpane.Url" DefaultValue="~remoteAppUrl/Home.html" />
<bt:Url id="Contoso.GetStarted.LearnMoreUrl" DefaultValue="https://go.microsoft.com/fwlink/?LinkId=276812" />
<bt:Url id="Urentaken.HubbaseInternFFUrl" DefaultValue="~remoteAppUrl/Functions/FunctionFile.html" />
</bt:Urls>
<!-- ShortStrings max characters==125. -->
<bt:ShortStrings>
<bt:String id="Contoso.TaskpaneButton.Label" DefaultValue="Show Taskpane" />
<bt:String id="Contoso.Group1Label" DefaultValue="Commands Group" />
<bt:String id="Contoso.GetStarted.Title" DefaultValue="Get started with your sample add-in!" />
<bt:String id="HubbaseIntern.CustomTabLbl" DefaultValue="Hubbase intern" />
<bt:String id="Urentaken.GroupUrenverwerkingLbl" DefaultValue="Urenverwerking"/>
<bt:String id="Urentaken.ButtonFormatUrenLbl" DefaultValue="Formateer uren"/>
<bt:String id="Urentaken.ButtonFormatUrenTitle" DefaultValue="Formateren van database uren"/>
<bt:String id="UrenTaken.ButtonFormatUrenDesc" DefaultValue="Het formateren van de uren direct uitgelezen van een database, naar een leesbare Nederlandse standaard" />
</bt:ShortStrings>
<!-- LongStrings max characters==250. -->
<bt:LongStrings>
<bt:String id="Contoso.TaskpaneButton.Tooltip" DefaultValue="Click to Show a Taskpane" />
<bt:String id="Contoso.GetStarted.Description" DefaultValue="Your sample add-in loaded succesfully. Go to the HOME tab and click the 'Show Taskpane' button to get started." />
</bt:LongStrings>
</Resources>
</VersionOverrides>
<!-- End Add-in Commands Mode integration. -->
</OfficeApp>
我也尝试过一些我在互联网上找到了带有自定义选项卡的清单,无论我尝试什么,这些清单似乎都会出错。我认为问题出在清单中,因为当我将代码放入 OfficeTab 或任务窗格中时,代码似乎可以工作。任何帮助表示赞赏!
I'm trying out Excel add-ins and try to get a custom ribbon going where I can organize different functions I want to deploy inside my organisation. I've been following a tutorial project what works, tried to change some logic. Now I'm at the point that I want to put my functions in a custom tab to keep the overview and easy access. Once I tried to change that in the manifest, I always get an error in Excel once I run the add-in code without any further explenation, see image:
The manifest I currently have is as following:
<?xml version="1.0" encoding="UTF-8"?>
<!--Created:ce44715c-8c4e-446b-879c-ea9ebe0f09c8-->
<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">
<!-- Begin Basic Settings: Add-in metadata, used for all versions of Office unless override provided. -->
<!-- IMPORTANT! Id must be unique for your add-in, if you reuse this manifest ensure that you change this id to a new GUID. -->
<Id>8da524bf-5dac-4b65-9194-0347541b9c11</Id>
<!--Version. Updates from the store only get triggered if there is a version change. -->
<Version>1.0.0.0</Version>
<ProviderName>[Provider name]</ProviderName>
<DefaultLocale>en-US</DefaultLocale>
<!-- The display name of your add-in. Used on the store and various places of the Office UI such as the add-ins dialog. -->
<DisplayName DefaultValue="HBUrenverwerking" />
<Description DefaultValue="HBUrenverwerking"/>
<!-- Icon for your add-in. Used on installation screens and the add-ins dialog. -->
<IconUrl DefaultValue="~remoteAppUrl/Images/Button32x32.png" />
<SupportUrl DefaultValue="http://www.contoso.com" />
<!-- Domains that will be allowed when navigating. For example, if you use ShowTaskpane and then have an href link, navigation will only be allowed if the domain is on this list. -->
<AppDomains>
<AppDomain>AppDomain1</AppDomain>
<AppDomain>AppDomain2</AppDomain>
<AppDomain>AppDomain3</AppDomain>
</AppDomains>
<!--End Basic Settings. -->
<!--Begin TaskPane Mode integration. This section is used if there are no VersionOverrides or if the Office client version does not support add-in commands. -->
<Hosts>
<Host Name="Workbook" />
</Hosts>
<DefaultSettings>
<SourceLocation DefaultValue="~remoteAppUrl/Home.html" />
</DefaultSettings>
<!-- End TaskPane Mode integration. -->
<Permissions>ReadWriteDocument</Permissions>
<!-- Begin Add-in Commands Mode integration. -->
<VersionOverrides xmlns="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="VersionOverridesV1_0">
<!-- The Hosts node is required. -->
<Hosts>
<!-- Each host can have a different set of commands. -->
<!-- Excel host is Workbook, Word host is Document, and PowerPoint host is Presentation. -->
<!-- Make sure the hosts you override match the hosts declared in the top section of the manifest. -->
<Host xsi:type="Workbook">
<!-- Form factor. Currently only DesktopFormFactor is supported. -->
<DesktopFormFactor>
<!--"This code enables a customizable message to be displayed when the add-in is loaded successfully upon individual install."-->
<GetStarted>
<!-- Title of the Getting Started callout. The resid attribute points to a ShortString resource -->
<Title resid="Contoso.GetStarted.Title"/>
<!-- Description of the Getting Started callout. resid points to a LongString resource -->
<Description resid="Contoso.GetStarted.Description"/>
<!-- Points to a URL resource which details how the add-in should be used. -->
<LearnMoreUrl resid="Contoso.GetStarted.LearnMoreUrl"/>
</GetStarted>
<!-- Function file is a HTML page that includes the JavaScript where functions for ExecuteAction will be called.
Think of the FunctionFile as the code behind ExecuteFunction. -->
<FunctionFile resid="Urentaken.HubbaseInternFFUrl" />
<!-- PrimaryCommandSurface is the main Office Ribbon. -->
<ExtensionPoint xsi:type="PrimaryCommandSurface">
<!-- Speciale tab voor automatiseren taken hubbase. -->
<CustomTab id="Hubbase.HubbaseIntern">
<!-- Groep met betrekking tot het verweken van gemaakte uren en doorsturen naar klanten van Hubbase -->
<Group id="Hubbase.HubbaseIntern.Urentaken">
<Label resid="Urentaken.GroupUrenverwerkingLbl" />
<Icon>
<bt:Image size="16" resid="Contoso.tpicon_16x16" />
<bt:Image size="32" resid="Contoso.tpicon_32x32" />
<bt:Image size="80" resid="Contoso.tpicon_80x80" />
</Icon>
<Control xsi:type="Button" id="Hubbase.HubbaseIntern.Urentaken.FormateerUren">
<Label resid="Urentaken.ButtonFormatUrenLbl" />
<Supertip>
<Title resid="Urentaken.ButtonFormatUrenTitle"/>
<Description resid="Urentaken.ButtonFormatUrenDesc"/>
</Supertip>
<Icon>
<bt:Image size="16" resid="Contoso.tpicon_16x16" />
<bt:Image size="32" resid="Contoso.tpicon_32x32" />
<bt:Image size="80" resid="Contoso.tpicon_80x80" />
</Icon>
<Action xsi:type="ExecuteFunction">
<FunctionName>formatUren</FunctionName>
</Action>
</Control>
<!-- <Control xsi:type="Button" id="Hubbase.HubbaseIntern.Urentaken.FormateerUren"> -->
</Group>
<!-- <Group id="Hubbase.HubbaseIntern.Urentaken"> -->
<Label resid="HubbaseIntern.CustomTabLbl" />
</CustomTab>
<!-- <CustomTab id="Hubbase.HubbaseIntern"> -->
</ExtensionPoint>
</DesktopFormFactor>
</Host>
</Hosts>
<!-- You can use resources across hosts and form factors. -->
<Resources>
<bt:Images>
<bt:Image id="Contoso.tpicon_16x16" DefaultValue="~remoteAppUrl/Images/Button16x16.png" />
<bt:Image id="Contoso.tpicon_32x32" DefaultValue="~remoteAppUrl/Images/Button32x32.png" />
<bt:Image id="Contoso.tpicon_80x80" DefaultValue="~remoteAppUrl/Images/Button80x80.png" />
</bt:Images>
<bt:Urls>
<bt:Url id="Contoso.DesktopFunctionFile.Url" DefaultValue="~remoteAppUrl/Functions/FunctionFile.html" />
<bt:Url id="Contoso.Taskpane.Url" DefaultValue="~remoteAppUrl/Home.html" />
<bt:Url id="Contoso.GetStarted.LearnMoreUrl" DefaultValue="https://go.microsoft.com/fwlink/?LinkId=276812" />
<bt:Url id="Urentaken.HubbaseInternFFUrl" DefaultValue="~remoteAppUrl/Functions/FunctionFile.html" />
</bt:Urls>
<!-- ShortStrings max characters==125. -->
<bt:ShortStrings>
<bt:String id="Contoso.TaskpaneButton.Label" DefaultValue="Show Taskpane" />
<bt:String id="Contoso.Group1Label" DefaultValue="Commands Group" />
<bt:String id="Contoso.GetStarted.Title" DefaultValue="Get started with your sample add-in!" />
<bt:String id="HubbaseIntern.CustomTabLbl" DefaultValue="Hubbase intern" />
<bt:String id="Urentaken.GroupUrenverwerkingLbl" DefaultValue="Urenverwerking"/>
<bt:String id="Urentaken.ButtonFormatUrenLbl" DefaultValue="Formateer uren"/>
<bt:String id="Urentaken.ButtonFormatUrenTitle" DefaultValue="Formateren van database uren"/>
<bt:String id="UrenTaken.ButtonFormatUrenDesc" DefaultValue="Het formateren van de uren direct uitgelezen van een database, naar een leesbare Nederlandse standaard" />
</bt:ShortStrings>
<!-- LongStrings max characters==250. -->
<bt:LongStrings>
<bt:String id="Contoso.TaskpaneButton.Tooltip" DefaultValue="Click to Show a Taskpane" />
<bt:String id="Contoso.GetStarted.Description" DefaultValue="Your sample add-in loaded succesfully. Go to the HOME tab and click the 'Show Taskpane' button to get started." />
</bt:LongStrings>
</Resources>
</VersionOverrides>
<!-- End Add-in Commands Mode integration. -->
</OfficeApp>
I've also tried some manifests I've found around the internet with custom tabs, which all seem to error no matter what I try. I reckon the problem is in the manifest, since the code seems to work when I put it in a OfficeTab or taskPane. Any help is appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
清除 Office 缓存通常可以修复与过时代码相关的问题。这可以保证使用当前文件名、菜单文本和其他命令元素上传最新的清单。要了解详细信息,请参阅清除 Office 缓存< /a>.
如果您使用的是 Office 网页版,请通过浏览器的 UI 清除浏览器的缓存。
请参阅验证 Office 加载项清单 和 使用以下命令调试您的加载项运行时日志记录来调试加载项清单问题。
Clearing the Office cache often fixes issues related to stale code. This guarantees the latest manifest is uploaded, using the current file names, menu text, and other command elements. To learn more, see Clear the Office cache.
If you're using Office on the web, clear your browser's cache through the browser's UI.
See Validate an Office Add-in's manifest and Debug your add-in with runtime logging to debug add-in manifest issues.