How To: Use Standard Office Icons in Your VSTO Solution





5.00/5 (3 votes)
This post is about using standard MS Office icons on a custom VSTO Office AddIn.
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.
The only thing that we need now is to get a value for the image id and we are good. There exist several approaches to retrieve these values.
I. Using Microsoft Visual Studio Tools for the Office System Power Tools
Go to: 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
Go to: 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
Go to: http://soltechs.net/CustomUI/imageMso01.asp and select one of the 9 galleries (or preview everything).
- 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. - Go back to your solution and fill up all desired buttons 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.