OverriddenByRibbonApi 元素

指定在支持在功能区上安装自定义上下文选项卡的 API (Office.ribbon.requestCreateControls) 的应用程序和平台组合上是否隐藏按钮控件、菜单控件或菜单项。

外接程序类型: 任务窗格

仅在以下 VersionOverrides 架构中有效

  • Taskpane 1.0

有关详细信息,请参阅 清单中的版本替代

与以下要求集关联

如果省略此元素,则默认值为 false。 如果使用它,它必须是其父元素 的第一个 子元素。

注意

若要全面了解此元素,请阅读 在不支持自定义上下文选项卡时实现备用 UI 体验

此元素的用途是在外接程序在不支持自定义上下文选项卡的应用程序或平台上运行时,在外接程序中创建实现自定义上下文选项卡的回退体验。 基本策略是将部分或全部组和控件从自定义上下文选项卡复制到自定义核心选项卡 (即 非文本自定义 选项卡) 。 然后,若要确保这些组和控件在不支持自定义上下文选项卡时显示,但在支持自定义上下文选项卡时不显示,请添加<OverriddenByRibbonApi>true</OverriddenByRibbonApi>“组>”、“控件”或“菜单项”元素的第一个子元素<<><> 这样做的效果如下:

  • 如果外接程序在支持自定义上下文选项卡的应用程序和平台上运行,则重复的组和控件不会出现在功能区上。 相反,当外接程序调用 requestCreateControls 方法时,将安装自定义上下文选项卡。
  • 如果外接程序在 不支持 自定义上下文选项卡的应用程序或平台上运行,则重复的组和控件将显示在功能区上。

示例

重写组

<ExtensionPoint xsi:type="PrimaryCommandSurface">
  <CustomTab id="Contoso.TabCustom">
    <Group id="Contoso.CustomTab.group1">
      <OverriddenByRibbonApi>true</OverriddenByRibbonApi>
      <Control  xsi:type="Button" id="Contoso.MyButton1">
        <!-- Child elements omitted. -->
      </Control>
    </Group>
    <Label resid="customTabLabel"/>
  </CustomTab>
</ExtensionPoint>

重写控件

<ExtensionPoint xsi:type="PrimaryCommandSurface">
  <CustomTab id="Contoso.TabCustom">
    <Group id="Contoso.CustomTab.group2">
      <Control  xsi:type="Button" id="Contoso.MyButton2">
        <OverriddenByRibbonApi>true</OverriddenByRibbonApi>
        <!-- Other child elements omitted. -->
      </Control>
    </Group>
    <Label resid="customTabLabel"/>
  </CustomTab>
</ExtensionPoint>

重写菜单项

<ExtensionPoint xsi:type="PrimaryCommandSurface">
  <CustomTab id="Contoso.TabCustom">
    <Group id="Contoso.CustomTab.group3">
      <Control  xsi:type="Menu" id="Contoso.MyMenu">
        <!-- Other child elements omitted. -->
        <Items>
          <Item id="showGallery">
            <OverriddenByRibbonApi>true</OverriddenByRibbonApi>
            <!-- Other child elements omitted. -->
          </Item>
        </Items>
      </Control>
    </Group>
    <Label resid="customTabLabel"/>
  </CustomTab>
</ExtensionPoint>