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

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

问题描述

如何将新组添加到现有(第三方)自定义功能区选项卡加载项?我知道可以通过指定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"属性,该属性与您要扩展的第3方加载项的customUI中声明的名称空间匹配.

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 Ribbon 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天全站免登陆