Ribbon Control Order and Shared Add-ins.

Add-in Express™ Support Service
That's what is more important than anything else

Ribbon Control Order and Shared Add-ins.
Experiencing problems with getting the buttons in the correct order.  
Jason Clark




Posts: 5
Joined: 2017-07-19
Hello, I have two add-ins both comadd-ins made with your product. The problem I am having is that the ADXGroups appear based on the order of which the add-ins are installed. The buttons are being put into the correct groups but the groups are not in the correct order. The groups are marked with shared=true (which is what gets the buttons in the correct groups).

Add-in one has one group with ID= MSHelp

Add-in Two has 3 groups one with ID=SettingsGroup, one with ID=ReportsGroup, and One with ID=MSHelp.

I need the group order to be settings, reporting, MSHelp. The problem is if I install add-in 1 first I get Help, Settings Reports.

all the groups are in the same Ribbon which is also marked shared.

Now I have set the InsertBeforeId property on each group in add-in 2 because it is the only one I have control over. But even with them set they don't seem to be being respected at all.

Thank you for any help you can offer. If you need any more information please ask and I will get what I can.
Posted 19 Jul, 2017 15:59:08 Top
Andrei Smolin


Add-in Express team


Posts: 14127
Joined: 2006-05-11
Hello Jason,

Jason Clark writes:
The problem I am having is that the ADXGroups appear based on the order of which the add-ins are installed.


If you clear the insertBefore/insertAfter properties I expect the groups to be shown in the alphabetical order of their add-ins' ProgIds. That is, if you unregister/uninstall the add-ins (this step is required!), rename the ProgIds, register the add-ins, and let them load, you'll see the groups created in the order of the ProgIds. You can further customize this order by using the insertBefore/insertAfter properties in a given add-in; make sure the group you refer to using these properties is created *before* the given add-in is loaded.

I also suggest that you print the Ribbon XMLs of your add-ins to a test file(s).

Below is a Ribbon XML of a Word template. It uses insertBefore (actually insertBeforeQ) to refer to a Ribbon group created by an add-in; idQs are used for clarity only:

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" xmlns:this="Template" onLoad="..." xmlns:shared="MyAddin.AddinModule">
  <ribbon startFromScratch="false">
    <tabs>
	<tab idQ="this:TabFromTemplate" label="a tab" getVisible ="GetVisible">	
		<group idQ="this:GroupFromTemplate" label ="..." insertBeforeQ="shared:GroupFromAddin">
...


That is, the Ribbon above puts its group *before* the group created by the add-in. The add-in's ProgId is "MyAddin.AddinModule"; it is used to identify the corresponding XML namespace.

The add-in creates this Ribbon XML:

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" xmlns:default="MyAddin.AddinModule" xmlns:shared="Template" onLoad="...">
  <ribbon startFromScratch="false">
    <tabs>
      <tab idQ="shared:TabFromTemplate" label="..." visible="true">
        <group ...callbacks... idQ="default:GroupFromAddin">
...


As you can see, the two Ribbon XMLs "know" about each other and use this knowledge to position the group. The specific requirement of the solution above was: the Ribbon created by the template must be shown *before* the group the add-in creates. In the case the add-in loads after the template is opened, this requirement is fulfilled automatically - since the add-in loads *after*, this means the template creates its Ribbon *before*. If the add-in loads first, the insertBeforeQ attribute works as expected: it positions the group correctly.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 20 Jul, 2017 08:23:23 Top
Jason Clark




Posts: 5
Joined: 2017-07-19
Ok I think I am following and I have proven that if I change the ProgId it will change the order of the add-ins. I am not sure how to print out the ribbon xml so that would be great to know because I do think it will help me solve this and other issues.

The last question is if I have add-in A installed can I make all of Add-in B's ribbon things show up first without making the progID alphabetical?
Posted 20 Jul, 2017 16:21:59 Top
Jason Clark




Posts: 5
Joined: 2017-07-19
So thank you for all the help, I was able to find and intercept the ribbon XML and get an understanding of how it works. Now I have everything getting put in the right place.
Posted 20 Jul, 2017 17:46:51 Top
Andrei Smolin


Add-in Express team


Posts: 14127
Joined: 2006-05-11
Hello Jason,

My congratulations! ))

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 21 Jul, 2017 03:17:08 Top