简体   繁体   English

是否可以为办公室功能区设置多个自定义选项卡?

[英]Is it possible to have more than one custom tab for the office ribbon?

I can not find any documentation to verify this or any working examples 我找不到任何文档来验证这个或任何工作示例

I want to achieve something like this xml below, but I think this really is not possible. 我想在下面实现类似xml的东西,但我认为这真的不可能。

<customUI onLoad="Ribbon_Load" xmlns="http://schemas.microsoft.com/office/2010/01/customui">
  <ribbon>
    <tabs>
      <tab idMso="TabAddIns" label="Ribbon1">
      </tab>

      <tab idMso="TabAddIns" label="Ribbon2">
      </tab>
    </tabs>
  </ribbon>

</customUI>

You can have multiple tabs, if you are using exiting tabs then set idMso="exiting tabids" 您可以有多个选项卡,如果您使用的是退出选项卡,则设置idMso="exiting tabids"

Existing tab ids should be valid ids which can be found here 现有的标签ID应该是有效的ID,可以在这里找到

If you are using your own custom tabs then use id="customtab1" instead of idMso 如果您使用自己的自定义选项卡,则使用id="customtab1"而不是idMso

customtab1 - can be any valid strings customtab1 - 可以是任何有效的字符串

EDITED EDITED

The below ribbon xml worked 以下功能区xml工作

<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
  <ribbon>
    <tabs>
      <tab idMso="TabAddIns" label="Ribbon1">
        <group id="MyGroup"
               label="My Group">
        </group>
      </tab>
      <tab id="CustomAddin" label="Ribbon2">
      <group id="CustomAddinGroup"
             label="My Group">
      </group>
      </tab>
    </tabs>
  </ribbon>
</customUI>

Try using Ribbon designer and convert to XML and make sure you add the below code in ThisAddin.cs file 尝试使用功能区设计器并转换为XML,并确保在ThisAddin.cs文件中添加以下代码

protected override Microsoft.Office.Core.IRibbonExtensibility CreateRibbonExtensibilityObject()
{
   return new Ribbon1();
}

You cannot have two tabs with the same id (idMso="TabAddIns"). 您不能有两个具有相同ID的选项卡(idMso =“TabAddIns”)。 Make sure the ids are unique. 确保ID是唯一的。

Change idMso for id and give your tabs a custom name. 更改id idMso并为您的标签提供自定义名称。

<customUI onLoad="Ribbon_Load" xmlns="http://schemas.microsoft.com/office/2010/01/customui">
  <ribbon>
    <tabs>
      <tab id="Tab1" label="Ribbon1">
      </tab>

      <tab id="Tab2" label="Ribbon2">
      </tab>
    </tabs>
  </ribbon>

</customUI>

idMso is used to refer to Microsoft Objects that already exists within the application hosting the ribbon. idMso用于指代托管功能区的应用程序中已存在的Microsoft对象。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM