How To Customize Ribbon in C#

1,433 views
Skip to first unread message

WA

unread,
Jul 14, 2011, 6:02:05 AM7/14/11
to Excel-DNA
Hi All,
I am new to ExcelDNA and just starting to get a hang of it.
currently browsing through the samples in the distribution.
I came across CustomTaskPane.dna which adds new tab to the ribbon and
responds to button events.
I want to know how this can be done in C# code instead of using 1dna
file that has xml declarartions to create the tab and event handling
code all in one file.
I need to be able to atleast split the code part out of the dna file,
so that i can easily use VS and intellisense to code it so that it can
call methods in other classes and more
Regards,
WA

Govert van Drimmelen

unread,
Jul 14, 2011, 7:25:36 AM7/14/11
to Excel-DNA
Hi WA,

The Excel-DNA Ribbon story is pretty flexible.

The code in your compiled library would be the same as in the .dna
file. The xml can either remain in the .dna file, or can be served by
you overriding the GetCustomUI method of ExcelRibbon, and returning
the xml string from a resource in your assembly or somewhere. The only
catch might be to set the COM Visible attribute, recently discussed
here: http://exceldna.codeplex.com/discussions/264810.

If you search in this group, you'll find quite a few discussions,
http://groups.google.com/group/exceldna/search?group=exceldna&q=ribbon+externallibrary&qt_g=Search+this+group.

There is also an open-source add-in called FinAnSu which uses Excel-
DNA and includes a Ribbon. You can download the add-in or browse the
source here: http://code.google.com/p/finansu/.

If this leaves you with any specific questions unanswered, I'd be
happy to help.

Regards,
Govert
Reply all
Reply to author
Forward
0 new messages