Adding Ribbon Group to Tab of other Excel xlam Addins

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

Adding Ribbon Group to Tab of other Excel xlam Addins
 
Frank Jepsen




Posts: 14
Joined: 2016-07-05
Hi,

I am new at Add-in Express and want to add a Ribbon Group of my new Add-in Express Addin to a Tab of other Excel xlam Addins. These Addins have a Ribbon-XML like this:
<customUI 
	xmlns="http://schemas.microsoft.com/office/2006/01/customui"
	xmlns:nsFrankJ="Franks Tools"
	onLoad="OnZDataRibbonLoad">
	<ribbon  startFromScratch="false" >
		<tabs >
			<tab 
				idQ="nsFrankJ:tabTools"
				insertBeforeMso="TabInsert"
				label="Tools"
				getVisible="GetVisible">
				<group 
					idQ="nsFrankJ:grpZData"
					label="ZData V1.6"
					getVisible="GetVisible">
					<labelControl 
						id="lblZData"
						label=" Datenbank:"
						getEnabled="GetEnabled"
						getVisible="GetVisible"/>
					<dropDown 
						id="CmbDBase"
						sizeString="Z1 - Lokal"
						getItemCount="CmbDBase_getItemCount"
						getItemLabel="CmbDBase_getItemLabel"
						getSelectedItemIndex="CmbDBase_getSelectedItemIndex"
						onAction="CmbDBase_OnAction"/>
					<button 
						id="btnReload"
						imageMso="RecurrenceEdit"
						label="Neu laden"
						screentip="Daten neu laden"
						onAction="OnZDataActionButton"/>
				</group >
			</tab >
		</tabs >
	</ribbon >
</customUI >

How can this be achieved?

Greetings
Frank
Posted 05 Jul, 2016 02:06:25 Top
Andrei Smolin


Add-in Express team


Posts: 14106
Joined: 2006-05-11
Hello Frank,

You need to check section Sharing Ribbon Controls across Multiple Add-ins, see the PDF file in the folder {Add-in Express}\Docs on your development PC. It describes sharing controls between two Add-in Express based add-ins. Since in your case some controls are located in the .XLAM, you need to change the Ribbon XML in the XLAM yourself. To find what changes are required you can study the Ribbon XML created by the COM add-in (or a couple of COM add-ins). An example of what should be done is discussed in How to change group order in shared Add-In. If you run in a problem, don't hesitate to ask me.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader‎
Posted 05 Jul, 2016 03:36:08 Top
Frank Jepsen




Posts: 14
Joined: 2016-07-05
Hi Andrej,

Thanks for your quick reply. Great support here.
I already read the section about sharing controls but I hoped I could avoid changing and redeploying all my addins to all users. As I understand you always use "shared" as namespace and this is a constant. So I have to change th XML of all my addins to something like below, set "Franks Tools" to TAddinModule.Namespace property and "tabTools" to Ribbon control's id:
<customUI  
    xmlns="http://schemas.microsoft.com/office/2006/01/customui" 
    xmlns:shared="Franks Tools" 
    onLoad="OnZDataRibbonLoad"> 
    <ribbon  startFromScratch="false" > 
        <tabs > 
            <tab  
                idQ="shared:tabTools" 
                insertBeforeMso="TabInsert" 
                label="Tools" 
                getVisible="GetVisible"> 
                <group  

Perhaps you could change adxAddinNS to a variable and make it public, add it as property to TAddinModule or allow something like "shared:Franks Tools" (I could use "nsFrankJ:Franks Tools") in TAddinModule.Namespace property in a future release.

I would patch it myself but I don't have the source of adxAddIn.pas.

Best regards
Frank
Posted 05 Jul, 2016 04:51:11 Top
Andrei Smolin


Add-in Express team


Posts: 14106
Joined: 2006-05-11
Frank,

Frank Jepsen writes:
Perhaps you could change adxAddinNS to a variable and make it public, add it as property to TAddinModule or allow something like "shared:Franks Tools"


To my knowledge, the XML syntax doesn't let you do this. Instead, you need to set the Namespace property to "Frank Tools". In this case, the generated Ribbon XML will contain the following IDQ for the Ribbon tab having the Shared property set to true:


<tab
idQ="shared:tabTools"
...


Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader‎
Posted 05 Jul, 2016 08:58:03 Top
Frank Jepsen




Posts: 14
Joined: 2016-07-05
I did some further testing. It looks like the adxAddinNS does not matter.
I just set
TadxCOMAddInModule.Namespace = "Franks Tools"
TadxRibbonTab.Id = "tabTools"
TadxRibbonTab.Shared = True

and all Groups appear on the same tab even so I did not change "nsFrankJ" to "shared".

So problem solved.

Thanks again
Frank
Posted 05 Jul, 2016 09:20:25 Top
Andrei Smolin


Add-in Express team


Posts: 14106
Joined: 2006-05-11
Correct. "nsFrankJ" and "shared" are just examples of a prefix allowing you to refer to the corresponding xmlns declarations. Sort of variable name.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader‎
Posted 05 Jul, 2016 09:37:18 Top