是否可以为 Office 功能区设置多个自定义选项卡? [英] 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
我想实现类似下面这个xml的东西,但我认为这真的不可能.
I want to achieve something like this xml below, but I think this really is not possible.
<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>
推荐答案
您可以有多个选项卡,如果您使用的是退出选项卡,则设置 idMso="exiting tabids"
You can have multiple tabs, if you are using exiting tabs then set idMso="exiting tabids"
现有标签 ID 应该是有效 ID,可以在 此处找到
Existing tab ids should be valid ids which can be found here
如果您使用自己的自定义选项卡,请使用 id="customtab1"
而不是 idMso
If you are using your own custom tabs then use id="customtab1"
instead of idMso
customtab1 - 可以是任何有效的字符串
customtab1 - can be any valid strings
已编辑
下面的功能区xml工作
The below ribbon xml worked
<?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>
尝试使用功能区设计器并转换为 XML 并确保在 ThisAddin.cs 文件中添加以下代码
Try using Ribbon designer and convert to XML and make sure you add the below code in ThisAddin.cs file
protected override Microsoft.Office.Core.IRibbonExtensibility CreateRibbonExtensibilityObject()
{
return new Ribbon1();
}
这篇关于是否可以为 Office 功能区设置多个自定义选项卡?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!