将自定义功能区组添加到 Word 2007 中现有的自定义功能区组 [英] Add a custom Ribbon group to an existing custom Ribbon group in word 2007

查看:30
本文介绍了将自定义功能区组添加到 Word 2007 中现有的自定义功能区组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何向现有(第 3 方)自定义功能区选项卡加载项添加新组?我知道我可以通过指定 Tabs idMSo 值来添加开箱即用的功能区,但如何为自定义功能区选项卡执行此操作.我已经尝试过自定义功能区的 ID 值,但它突出重复功能区?还尝试了 idMso 和 idQ 属性传入所需的自定义选项卡 ID,但没有成功.

How can I add a new group to an existing (3rd party) custom ribbon tab add-in? I know that I can add to out of box ribbons by specifying the Tabs idMSo value but how do I do that for a custom ribbon tab. I have already tried the ID value of the custom ribbon, but it juts duplicates the ribbon? have also tried idMso and idQ attributes passing in the required custom tab Id but no success.

我可以通过指定 idMso 值而不是自定义选项卡将其添加到开箱即用的选项卡组

I can add it to out of box tab group by specifying the idMso value but not to custom tab

问候

推荐答案

idQ 是正确的方法.此属性允许您指定一个合格的 id,即命名空间中的一个 id.mso 等一些命名空间是内置的,但也可以指定自定义命名空间.

idQ is the right way to go. This attribute allows you specify a qualified id, i.e. an id within a namespace. Some namespaces such as mso are built in, but custom namespaces can also be specified.

关键是您需要 customUI 元素中的 xmlns:foo="bar" 属性与 customUI 中声明的命名空间相匹配> 您尝试扩展的第 3 方加载项.

The key is that you need a xmlns:foo="bar" attribute in your customUI element that matches the namespace declared within the customUI of the 3rd party add-in you are trying to extend.

例如,假设我有以下第 3 方加载项的 XML:

For example, suppose I have the XML for the following 3rd party add-in:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<mso:customUI xmlns:mso="http://schemas.microsoft.com/office/2009/07/customui"
              xmlns:foo="bar">
  <mso:ribbon>
    <mso:tabs>
      <mso:tab idQ="foo:someTab" label="an extensible custom tab">
        <mso:group id="someGroup" label="a custom group">
          <mso:button id="someButton" label="button" />
        </mso:group>
      </mso:tab>
    </mso:tabs>
  </mso:ribbon>
</mso:customUI>

现在,我想用另一个加载项或模板中的新组扩展现有的 foo:someTab.我在新加载项中定义了一个 customUI,确保在 customUI 元素中指定相同的命名空间属性.然后我使用 idQ="foo:someTab":

Now, I want to extend the existing foo:someTab with a new group in another add-in or template. I define a customUI in the new add-in, making sure to specify the same namespace attribute in the customUI element. I then reference the existing tab using idQ="foo:someTab":

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <mso:customUI xmlns:mso="http://schemas.microsoft.com/office/2009/07/customui"
                  xmlns:foo="bar">
      <mso:ribbon>
        <mso:tabs>
          <mso:tab idQ="foo:someTab" label="an extensible custom tab">
            <mso:group id="someOtherGroup" label="a different custom group">
              <mso:button id="someOtherButton" label="a different button" />
            </mso:group>
          </mso:tab>
        </mso:tabs>
      </mso:ribbon>
    </mso:customUI>

这会在一个自定义选项卡上生成两个组.可以使用相同的方法扩展组和其他容器控件.

This results two groups on a single custom tab. The same approach can be used to extend groups and other container controls.

我通过仔细研究 Office 2010 功能区 UI XSD.不幸的是,它在 XSD 本身之外的记录很差.

I learned this through careful study of the Office 2010 Ribbon UI XSD. Unfortunately, it's poorly documented outside of the XSD itself.

这篇关于将自定义功能区组添加到 Word 2007 中现有的自定义功能区组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆