How to change group order in shared Add-In

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

How to change group order in shared Add-In
 
uweacs




Posts: 7
Joined: 2016-04-25
Hello,

I am trying to create an AddIn for Word which shall use an already existing Tab that is created from a VBA-Addin with a custom ribbon.

I managed to add a new group to the existing Tab with using the namespace and ID.
What I dont get to work is to influence the position of the new group.

The xml of the existing group in the customUI looks like this:
<group idQ="AMC:FooterGroup" autoScale="false" centerVertically="false" label="Footer" ...>


I tried to set the insertAfterId property of my new group to "FooterGroup" in my adx add-in, but this seems not to work. Is there something else I must do to change the Position of my new Group?

Thanks in advance!
Posted 25 Apr, 2016 08:50:35 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Uwe,

You need to set the qualified identifier (idQ) to the InsertAfterId property. Please have a look at the insertAfterQ attribute description of the https://msdn.microsoft.com/en-us/library/dd920716%28v=office.12%29.aspx specification.
Posted 25 Apr, 2016 10:48:04 Top
Uwe H




Posts: 7
Joined: 2016-04-25
Hi Dmitry,

i tried to set my new Group like this:
adxRibbonGroupTest.InsertAfterId = "AMC:FooterGroup";

and also:
adxRibbonGroupTest.InsertAfterId = "FooterGroup";


I also tried to set it in the designer, but both ways did not work and the result was always showing in the same order in Word.
Posted 26 Apr, 2016 02:30:08 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Uwe,

I have just created two Word add-ins and managed to get the ribbon tab from add-in #2 to be inserted before the ribbon tab of add-in #1. You can download and test the projects using the link below:
https://www.add-in-express.com/projects/forum/TwoWordAddins.zip

The key point is that the AddinModule.Namespace property should contain the same value in both add-ins. If the sample does not solve your problem, please send your project(s) to our support email for testing.
Posted 26 Apr, 2016 06:02:50 Top
Uwe H




Posts: 7
Joined: 2016-04-25
Hi Dmitry,

maybe the Problem is that i dont have two COM Addins but one old VBA and one new COM which need to find eachother. The namespace is already set right because my new group appears in the same RibbonTab. But the order is still wrong.

I will try to make a slimmed down project to send to the support mail, but it might take some days until I find the time.
Thanks already for the help
Posted 27 Apr, 2016 05:15:40 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Uwe,

May it be that your VBA ribbon is created later than that of the new COM Add-in? In this case, the ribbon group specified in the InsertAfterId property does not exist at the add-in loading time and Word cannot position your group properly.
Posted 27 Apr, 2016 07:20:06 Top
Uwe H




Posts: 7
Joined: 2016-04-25
Hi Dmitry,

sorry for the delay.

I am not sure how the order of loading is in Word for VBA-Addins vs. COM Addins. If this is the problem: how would I need to change my project? Maybe the VBA Addin would need to be modified instead? I would like to avoid this (because it is deployed already) but if its the only option then maybe I can do so.

I have sent a mail to support too with a slimmed down example.

Thanks again
Uwe
Posted 20 May, 2016 07:22:58 Top
Andrei Smolin


Add-in Express team


Posts: 18829
Joined: 2006-05-11
Hello Uwe,

Thank you for sending use the document and the project.

I've found out that this only works if you use the COM add-ins dialog to turn your add-in on *after* startup. This looks like a bug in Word.


Andrei Smolin
Add-in Express Team Leader‎
Posted 20 May, 2016 10:05:08 Top
Uwe H




Posts: 7
Joined: 2016-04-25
Hello Andrei,

thanks for confirming about the problem. Is there a way to delay the loading of the COM Add-In? Manually turning it on by the user would not be an option for us really I think.

Or maybe you would have an idea for another workaround? Maybe the VBA Addin can be modified to change its ribbon elements positions ahead of the COM-Addin?

Regards,
Uwe
Posted 20 May, 2016 10:29:39 Top
Andrei Smolin


Add-in Express team


Posts: 18829
Joined: 2006-05-11
Hello Uwe,

This works as expected after I've modified the document's Ribbon in this way:
1. I added the xmlns:shared="{the value of the progId attribute of the add-in module here}" attribute to the customUI tag
2. I added the insertBeforeQ="shared:myRibbonGroup" attribute to every group.

This shows the groups in this order:
- the three groups from the document's Ribbon,
- the group from the add-in.

The add-in only requires that you set 1) the Id of the tab component to the Id of the tab tag from the document's Ribbon and 2) the tab's component Shared property to true. No other settings or code.


Andrei Smolin
Add-in Express Team Leader‎
Posted 23 May, 2016 05:16:01 Top