【问题标题】:How to set ribbon icon for my excel add-in如何为我的 excel 加载项设置功能区图标
【发布时间】:2018-03-21 22:08:56
【问题描述】:

我已经为我的 excel 功能区的按钮设置了图标。但它仍然显示默认图像:

<ExtensionPoint xsi:type="PrimaryCommandSurface">
        <!-- Use OfficeTab to extend an existing Tab. Use CustomTab to create a new tab. -->
        <OfficeTab id="TabHome">
          <!-- Ensure you provide a unique id for the group. Recommendation for any IDs is to namespace using your company name. -->
          <Group id="Excely.SheetExplorer.Group">
            <!-- Label for your group. resid must point to a ShortString resource. -->
            <Label resid="Excely.GroupLabel" />
            <!-- Icons. Required sizes 16,32,80, optional 20, 24, 40, 48, 64. Strongly recommended to provide all sizes for great UX. -->
            <!-- Use PNG icons. All URLs on the resources section must use HTTPS. -->
            <Icon>
              <bt:Image size="16" resid="Excely.tpicon_16x16" />
              <bt:Image size="32" resid="Excely.tpicon_32x32" />
              <bt:Image size="80" resid="Excely.tpicon_80x80" />
            </Icon>

            <!-- Control. It can be of type "Button" or "Menu". -->
            <Control xsi:type="Button" id="Excely.TaskpaneButton">
              <Label resid="Excely.TaskpaneButton.Label" />
              <Supertip>
                <!-- ToolTip title. resid must point to a ShortString resource. -->
                <Title resid="Excely.TaskpaneButton.Label" />
                <!-- ToolTip description. resid must point to a LongString resource. -->
                <Description resid="Excely.TaskpaneButton.Tooltip" />
              </Supertip>
              <Icon>
                <bt:Image size="16" resid="Excely.tpicon_16x16" />
                <bt:Image size="32" resid="Excely.tpicon_32x32" />
                <bt:Image size="80" resid="Excely.tpicon_80x80" />
              </Icon>

              <!-- This is what happens when the command is triggered (E.g. click on the Ribbon). Supported actions are ExecuteFunction or ShowTaskpane. -->
              <Action xsi:type="ShowTaskpane">
                <TaskpaneId>ShowMainMenu</TaskpaneId>
                <!-- Provide a URL resource id for the location that will be displayed on the task pane. -->
                <SourceLocation resid="Excely.Taskpane.Url" />
              </Action>
            </Control>
          </Group>
        </OfficeTab>
      </ExtensionPoint>

我应该在哪里设置功能区的图像?

更新:我发现问题不在于清单设置。如果我将 Web 项目配置从 Local IIS 更改为 IIS Express,则图标工作正常。但是设置为Local IIS时会出现默认图标!

【问题讨论】:

    标签: excel office-js office-addins


    【解决方案1】:

    您提供的清单部分仅显示您创建的残留名称。在清单的 Resources 部分(您未显示)中,您需要使用图标文件的 URL 定义这些残留值。

    此外,对按钮图标的更改有时不会生效,除非您清除 Office 缓存。见Clear the Office Cache

    【讨论】:

    • 我这里只带了一部分manifest文件……你说的资源部分没问题。我发现它与local iisiis express 有关。我已经更新了提到这个事实的问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-01-31
    • 2019-11-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多