Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add a custom Ribbon group to an existing custom Ribbon group in word 2007

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.

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

regards

like image 487
SwiftLion Avatar asked Jun 16 '10 09:06

SwiftLion


1 Answers

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.

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.

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>

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.

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

like image 157
AndreiM Avatar answered Sep 29 '22 08:09

AndreiM