This post is about using standard MS Office icons on a custom VSTO Office AddIn. This can be achieved by setting up the
imageMso property on a Ribbon designer.
- Create a simple Office AddIn project. This example is using Excel AddIn, but the approach is absolutely the same on Word, PowerPoint or any other Office AddIn.
- Add new item – Ribbon control.
- Add several buttons where we want to apply standard Office icons.
- Go to button’s properties and find the “OfficeImageId” property.
The only thing that we need now is to get a value for the image id and we good. There are exist several approaches to retrieve these values.
I. Using Microsoft Visual Studio Tools for the Office System Power Tools.
Goto: http://www.microsoft.com/download/en/details.aspx?id=7805 and download
the “VSTO_PTRibbonIDs.exe”. This will install a plugin for Visual Studio, but only for 2008 and lower (unfortunately).
Open up Visual Studio 2008 and go to Tools –> ImageMso Window
Inside the opened window just click the icon you want to get the “idMso” property and it will be copied to clipboard,
so you can just simply paste it to button’s “OfficeImageId”.
II. Using the macro-enabled Word or Excel document with the same set of Images.
Goto: http://www.microsoft.com/download/en/details.aspx?id=21103 and download the “Office2010IconsGallery.docx”.
Open the document and click “Enable Editing”. Then go to File menu and select of the “ImageMso 0” or “Image Mso 1” menu items.
III. Online gallery.
Goto: http://soltechs.net/CustomUI/imageMso01.asp and select one of the 9 galleries (or preview everything).
- Go back to your solution and fill up all desired button with standard office images and enjoy the result:
As usual the Visual Studio solution and code files could be found on my
public SVN: http://subversion.assembla.com/svn/max-s-blog-posts/ (ImageMsoExcelAddIn project).
Thank you and best regards. Max B.