Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

<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>
like image 374
Clinton Ward Avatar asked Aug 22 '13 01:08

Clinton Ward


People also ask

Can you customize the ribbon with different tabs?

Add custom tabs and groupsSelect File > Options > Customize Ribbon. To add a new tab to the ribbon, select New Tab. To remove a tab, in the Customize the Ribbon list, select it. Then select Remove.

How do I add a custom tab to the ribbon?

To create a custom tabOn the Project menu, choose Add New Item. In the Add New Item dialog box, select Ribbon (Visual Designer). Change the name of the new ribbon to MyRibbon, and choose Add.

How do you customize the ribbon in PowerPoint?

Select PowerPoint, then Preferences… followed by Ribbon & Toolbar and finally click into the Ribbon tab. Mac and PC users alike will see a long list of commands on the left, and on the right is where you tailor your tabs and the commands within them.


2 Answers

You can have multiple tabs, if you are using exiting tabs then set idMso="exiting tabids"

Existing tab ids should be valid ids which can be found here

If you are using your own custom tabs then use id="customtab1" instead of idMso

customtab1 - can be any valid strings

EDITED

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>

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();
}
like image 95
Kiru Avatar answered Nov 15 '22 16:11

Kiru


Change idMso for id and give your tabs a custom name.

<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.

like image 44
dee-see Avatar answered Nov 15 '22 15:11

dee-see