英文:
control icon on ribbon fails to show for Office Addin for Excel instead it shows default icon
问题
我在开发 Office 插件,我已经在自定义选项卡上添加了一个控件,但该控件显示的图标图片与指定的图标不符,而是显示默认图标。
那么,如何才能在功能区中显示为每个控件指定的图标呢?
参考链接: link
Manifest.xml 文件:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<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>81d7e91a-c8e6-454f-806a-9b84cf3e7dd5</Id>
<Version>1.0.0.0</Version>
<ProviderName>Contoso</ProviderName>
<DefaultLocale>en-US</DefaultLocale>
<DisplayName DefaultValue="Add-in"/>
<Description DefaultValue="A template to get started."/>
<IconUrl DefaultValue="https://localhost:3000/assets/icon-32.png"/>
<HighResolutionIconUrl DefaultValue="https://localhost:3000/assets/icon-64.png"/>
<SupportUrl DefaultValue="https://www.contoso.com/help"/>
<AppDomains>
<AppDomain>https://www.contoso.com</AppDomain>
</AppDomains>
<Hosts>
<Host Name="Workbook"/>
</Hosts>
<DefaultSettings>
<SourceLocation DefaultValue="https://localhost:3000/taskpane.html"/>
</DefaultSettings>
<Permissions>ReadWriteDocument</Permissions>
<VersionOverrides xmlns="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="VersionOverridesV1_0">
<Hosts>
<Host xsi:type="Workbook">
<DesktopFormFactor>
<FunctionFile resid="Commands.Url"/>
<ExtensionPoint xsi:type="PrimaryCommandSurface">
<CustomTab id="CustomTab">
<Label resid="ribbonNameLabel" />
<Group id="AuthGroup">
<Label resid="AuthGroupNameLabel" />
<Icon>
<bt:Image size="16" resid="Group1LoginIcon16" />
<bt:Image size="32" resid="Group1LoginIcon32" />
<bt:Image size="80" resid="Group1LoginIcon80" />
</Icon>
<Control xsi:type="Button" id="LoginControl">
<Label resid="LoginButtonLabel" />
<Supertip>
<Title resid="LoginButtonToolTipTitle" />
<Description resid="LoginButtonToolTipDescription" />
</Supertip>
<Icon>
<bt:Image size="16" resid="Group1LoginIcon16" />
<bt:Image size="32" resid="Group1LoginIcon32" />
<bt:Image size="80" resid="Group1LoginIcon80" />
</Icon>
<Action xsi:type="ShowTaskpane">
<TaskpaneId>LoginPanelId</TaskpaneId>
<Title resid="LoginTaskPaneTitle" />
<SourceLocation resid="LoginTaskPaneUrl" />
</Action>
</Control>
</Group>
</CustomTab>
</ExtensionPoint>
</DesktopFormFactor>
</Host>
</Hosts>
<Resources>
<bt:Images>
<bt:Image id="Group1LoginIcon16" DefaultValue="https://localhost:3000/assets/icon-16.png"/>
<bt:Image id="Group1LoginIcon32" DefaultValue="https://localhost:3000/assets/icon-32.png"/>
<bt:Image id="Group1LoginIcon80" DefaultValue="https://localhost:3000/assets/icon-64.png"/>
</bt:Images>
<bt:Urls>
<bt:Url id="Commands.Url" DefaultValue="https://localhost:3000/commands.html"/>
<bt:Url id="LoginTaskPaneUrl" DefaultValue="https://localhost:3000/taskpane.html"/>
</bt:Urls>
<bt:ShortStrings>
<bt:String id="ribbonNameLabel" DefaultValue="Add-in"/>
<bt:String id="AuthGroupNameLabel" DefaultValue="Auth"/>
<bt:String id="LoginButtonLabel" DefaultValue="Login" />
<bt:String id="LoginTaskPaneTitle" DefaultValue="Login" />
<bt:String id="LoginButtonToolTipTitle" DefaultValue="Tooltip Title" />
</bt:ShortStrings>
<bt:LongStrings>
<bt:String id="LoginButtonToolTipDescription" DefaultValue="Tooltip Description" />
</bt:LongStrings>
</Resources>
</VersionOverrides>
</OfficeApp>
任何帮助将不胜感激。
谢谢
英文:
I am working on office addin where I have added a control on a custom tab. but the control does not show the Icon image specified instead it shows default icon.
So how can we show the icon specified for each control in ribbon ?
Reffered link: link
Following is the ribbon image showing default icon :
Manifest.xml file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<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>81d7e91a-c8e6-454f-806a-9b84cf3e7dd5</Id>
<Version>1.0.0.0</Version>
<ProviderName>Contoso</ProviderName>
<DefaultLocale>en-US</DefaultLocale>
<DisplayName DefaultValue="Add-in"/>
<Description DefaultValue="A template to get started."/>
<IconUrl DefaultValue="https://localhost:3000/assets/icon-32.png"/>
<HighResolutionIconUrl DefaultValue="https://localhost:3000/assets/icon-64.png"/>
<SupportUrl DefaultValue="https://www.contoso.com/help"/>
<AppDomains>
<AppDomain>https://www.contoso.com</AppDomain>
</AppDomains>
<Hosts>
<Host Name="Workbook"/>
</Hosts>
<DefaultSettings>
<SourceLocation DefaultValue="https://localhost:3000/taskpane.html"/>
</DefaultSettings>
<Permissions>ReadWriteDocument</Permissions>
<VersionOverrides xmlns="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="VersionOverridesV1_0">
<Hosts>
<Host xsi:type="Workbook">
<DesktopFormFactor>
<FunctionFile resid="Commands.Url"/>
<ExtensionPoint xsi:type="PrimaryCommandSurface">
<CustomTab id="CustomTab">
<Label resid="ribbonNameLabel" />
<Group id="AuthGroup">
<Label resid="AuthGroupNameLabel" />
<Icon>
<bt:Image size="16" resid="Group1LoginIcon16" />
<bt:Image size="32" resid="Group1LoginIcon32" />
<bt:Image size="80" resid="Group1LoginIcon80" />
</Icon>
<Control xsi:type="Button" id="LoginControl">
<Label resid="LoginButtonLabel" />
<Supertip>
<Title resid="LoginButtonToolTipTitle" />
<Description resid="LoginButtonToolTipDescription" />
</Supertip>
<Icon>
<bt:Image size="16" resid="Group1LoginIcon16" />
<bt:Image size="32" resid="Group1LoginIcon32" />
<bt:Image size="80" resid="Group1LoginIcon80" />
</Icon>
<Action xsi:type="ShowTaskpane">
<TaskpaneId>LoginPanelId</TaskpaneId>
<Title resid="LoginTaskPaneTitle" />
<SourceLocation resid="LoginTaskPaneUrl" />
</Action>
</Control>
</Group>
</CustomTab>
</ExtensionPoint>
</DesktopFormFactor>
</Host>
</Hosts>
<Resources>
<bt:Images>
<bt:Image id="Group1LoginIcon16" DefaultValue="https://localhost:3000/assets/icon-16.png"/>
<bt:Image id="Group1LoginIcon32" DefaultValue="https://localhost:3000/assets/icon-32.png"/>
<bt:Image id="Group1LoginIcon80" DefaultValue="https://localhost:3000/assets/icon-64.png"/>
</bt:Images>
<bt:Urls>
<bt:Url id="Commands.Url" DefaultValue="https://localhost:3000/commands.html"/>
<bt:Url id="LoginTaskPaneUrl" DefaultValue="https://localhost:3000/taskpane.html"/>
</bt:Urls>
<bt:ShortStrings>
<bt:String id="ribbonNameLabel" DefaultValue="Add-in"/>
<bt:String id="AuthGroupNameLabel" DefaultValue="Auth"/>
<bt:String id="LoginButtonLabel" DefaultValue="Login" />
<bt:String id="LoginTaskPaneTitle" DefaultValue="Login" />
<bt:String id="LoginButtonToolTipTitle" DefaultValue="Tooltip Title" />
</bt:ShortStrings>
<bt:LongStrings>
<bt:String id="LoginButtonToolTipDescription" DefaultValue="Tooltip Description" />
</bt:LongStrings>
</Resources>
</VersionOverrides>
</OfficeApp>
Any help will be appreciated.
Thanks
答案1
得分: 1
首先,请确保通过导航到清单中指定的URL来访问所有图标。如果您看不到图标,请使其可访问。
其次,请确保在Excel中没有显示任何功能区UI错误。默认情况下,如果插件尝试操纵Microsoft Office用户界面(UI)并失败,将不会显示错误消息。但是,您可以配置Microsoft Office应用程序以显示与UI相关的错误消息。您可以使用这些消息来帮助确定自定义功能区未显示的原因,或者为什么功能区显示但没有控件显示。
- 启动应用程序。
- 单击“文件”选项卡。
- 单击“选项”。
- 在类别窗格中,单击“高级”。
- 在详细信息窗格中,选择“显示VSTO插件用户界面错误”,然后单击“确定”。
第三,如果您的新图像未显示,请尝试清除Office缓存。
英文:
First of all, make sure that all icons are accessible by navigating to the URL specified in the manifest. If you don't see the icon then make it accessible.
Second, make sure no ribbon UI errors are shown in Excel. By default, if an add-in attempts to manipulate the Microsoft Office user interface (UI) and fails, no error message is displayed. However, you can configure Microsoft Office applications to display messages for errors that relate to the UI. You can use these messages to help determine why a custom ribbon does not appear, or why a ribbon appears but no controls appear.
- Start the application.
- Click the
File
tab. - Click
Options
. - In the categories pane, click
Advanced
. - In the details pane, select
Show VSTO Add-in user interface errors
, and then clickOK
.
Third, try to Clear the Office cache if your new images are not displayed.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论