At first I tried to add child.dll as ExternalLibrary which did not have customUI, and they can work well together.
And then, I tried to add customUI in child.dll. There are the ribbon code for both child and parent.
namespace Child.Excel
{ [ComVisible(true)] public class ChildRibbonHandler : ExcelRibbon, IDisposable {
public void Dispose() { Dispose(true); GC.SuppressFinalize(this); }
protected virtual void Dispose(bool disposing) { } public static ExcelDna.Integration.CustomUI.IRibbonUI myRibbon; public override string GetCustomUI(string RibbonID) {
return @" <customUI xmlns='http://schemas.microsoft.com/office/2009/07/customui' loadImage='LoadImage' onLoad='ChildRibbon_onLoad'> <ribbon> <tabs> <tab id='ChildTab' label='Child'> <group id='TestGroup' label='Test'> <button id='Test' label='Test' keytip='T' imageMso='AdpPrimaryKey' size='large' /> </group> </tab> </tabs> </ribbon><backstage onShow='Backstage_onShow'/> </customUI>"; }
}}namespace Parent.Excel
{
[ComVisible(true)] public class ParentRibbonHandler : ExcelRibbon, IDisposable {
public void Dispose() { Dispose(true); GC.SuppressFinalize(this); }
protected virtual void Dispose(bool disposing) { } public static ExcelDna.Integration.CustomUI.IRibbonUI myRibbon; public override string GetCustomUI(string RibbonID) {
return @" <customUI xmlns='http://schemas.microsoft.com/office/2009/07/customui' loadImage='LoadImage' onLoad='ParentdRibbon_onLoad'> <ribbon> <tabs> <tab id='ParentTab' label='Parent'> <group id='TesttGroup' label='Testt'> <button id='Testt' label='Testt' keytip='E' imageMso='AdpPrimaryKey' size='large' /> </group> </tab> </tabs> </ribbon><backstage onShow='Backstage_onShow'/> </customUI>"; }
}}This is my .dna file
<DnaLibrary Name="Parent Add-In" RuntimeVersion="v4.0"> <ExternalLibrary Path="Parent.dll" LoadFromBytes="true" Pack="true" ExplicitExports="true" /> <ExternalLibrary Path="Child.dll" LoadFromBytes="true" Pack="true" ExplicitExports="true" />
</DnaLibrary>
This is error I got, when I enable the addin
Initialization [Error] Method not registered - unsupported
signature, abstract or generic: 'ArrayResizer.Resize'
ComAddIn [Error] The Ribbon/COM add-in helper required by
add-in Parent Add-In could not be registered.
This is an unexpected error.
Error details: System.Reflection.TargetInvocationException:
Exception has been thrown by the target of an invocation. --->
System.Runtime.InteropServices.COMException: Operation aborted (Exception from
HRESULT: 0x80004004 (E_ABORT))
--- End of inner
exception stack trace ---
at
System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr,
Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[]
namedParameters)
at
System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder
binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers,
CultureInfo culture, String[] namedParams)
at
ExcelDna.Integration.ExcelComAddInHelper.LoadComAddIn(ExcelComAddIn addIn) :
TargetInvocationException - Exception has been thrown by the target of an
invocation.
ComAddIn [Error] The Ribbon/COM add-in helper required by
add-in Parent Add-In could not be registered.
This is an unexpected error.
Error details: System.Reflection.TargetInvocationException:
Exception has been thrown by the target of an invocation. --->
System.Runtime.InteropServices.COMException: Operation aborted (Exception from
HRESULT: 0x80004004 (E_ABORT))
--- End of inner
exception stack trace ---
Do you guys know how to correctly add multiple dll with their own customUIs? It is hard to find some sample similar with that.
Thank you very much.
I would expect this to work fine.
Could you make a little solution with the two projects, add-in etc. that I can just load and run to find the problem?
Easiest is if you put on GitHub someehere, but you can post .zip file here too.
-Govert
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Excel-DNA: Free and easy .NET for Excel
Develop Excel Conference - London, 18 October 2018
https://developexcel.wordpress.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
exceldna+u...@googlegroups.com.
To post to this group, send email to exce...@googlegroups.com.
Visit this group at https://groups.google.com/group/exceldna.
For more options, visit https://groups.google.com/d/optout.
Yes – you can add buttons etc. to other tabs.
Look at the SharedGroup examples here: https://github.com/Excel-DNA/ExcelDna/tree/master/Distribution/Samples/Ribbon
<tabs> <tab idMso='TabAddIns' label='My Tab'> <group idQ='x:Contoso' label='Contoso'> <button id='C1' label='Child' imageMso='AdpPrimaryKey' size='large' /> </group> </tab> </tabs>
<tabs> <tab idMso='TabAddIns' label='My Tab'> <group idQ='x:Contoso' label='Contoso'> <button id='C2' label='Parent' imageMso='AdpPrimaryKey' size='large' /> </group> </tab> </tabs>To post to this group, send email to exc...@googlegroups.com.
<tab idQ='x:ContosoTab' label='My Tab'> <group idQ='x:Contoso' label='Contoso'> <button id='C2' label='Parent' imageMso='AdpPrimaryKey' size='large' /> </group> </tab><tab idQ='x:ContosoTab' label='My Tab'> <group idQ='x:Contoso' label='Contoso'> <button id='C1' label='Child' imageMso='AdpPrimaryKey' size='large' /> </group> </tab>