Embedded ribbon picture

501 views
Skip to first unread message

Sebastian

unread,
Sep 18, 2013, 8:04:20 AM9/18/13
to exce...@googlegroups.com
Hi All,

I found thats possible to add  picture to custom ribbon by adding path to dna file :

<Image Name="M" Path="m.png" Pack="true" />

and next in ribbon xml  definition add it :

<button id="btnButton1" label="DoSomething" image='M' size='large' />

In my case this ribbon xml definition is embedded inside resources file and its given as string in GetCustomUI.  Is it possible to avoid having path to picture in dna file and define in resource ?

Regards,
Sebastian

Govert van Drimmelen

unread,
Sep 18, 2013, 9:15:48 AM9/18/13
to exce...@googlegroups.com
Hi Sebastian,

You can, but then not use the Excel-DNA packing to embed those images.

To do this you'd embed the pictures in resources of your own assembly, so that you can access them at runtime in your code. Then in your ExcelRibbon-derived class, also override the LoadImage method (which is set in your ribbon xml as the loadImage callback).

Your LoadImage override gets the string imageId, and can return 
1. An IPictureDisp
2. A System.Drawing.Bitmap
3. A string containing an imageMso identifier
(or call the base implementation).

You might also find the Office image gallery (http://imagemso.codeplex.com/) useful to discover built-in Office images. (The gallery has a viewer that is built with Excel-DNA too!)

Regards,
Govert


From: exce...@googlegroups.com [exce...@googlegroups.com] on behalf of Sebastian [zawa...@gmail.com]
Sent: 18 September 2013 02:04 PM
To: exce...@googlegroups.com
Subject: [ExcelDna] Embedded ribbon picture

--
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 http://groups.google.com/group/exceldna.
For more options, visit https://groups.google.com/groups/opt_out.

Sebastian

unread,
Sep 20, 2013, 9:15:55 AM9/20/13
to exce...@googlegroups.com
Hi Govert,
Thanks, its works fine.

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