GDI+ error from Office ribbon custom UI editor

I use the Custom UI Editor to edit the office ribbon XML (Click here for link).

When I try to load a ICO file to use as a ribbon icon I get the following error:Error shown when addin an icon to ribbonx
Can anyone tell me how to correct this ? Is there any way around it ?

The environment is Windows 7 Professional 64bit (Service Pack 1). I have tried it on two separate computers and had the same error. I have even tried installing the program again or running under administrator approval mode.
LVL 3
AL_XResearchAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rory ArchibaldCommented:
Is this with any .ico file, regardless of name and location? (it's generally wise to avoid using image files with spaces in the names)
0
AL_XResearchAuthor Commented:
I have tried it with a number of ICO files from different sources, ones which I have created, ones that have been created by MS and i would think with a variety of names. I will check that there is no space in the filename and get back to you.

Any further thoughts in the mean time ?
0
AL_XResearchAuthor Commented:
Yes it was a filename without spaces or underscores. JPG or PNG gives me no issues.

I find though that PNG files loaded using the editor do not show up on the ribbon though.
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Rory ArchibaldCommented:
It appears that .ico files don't work if they have multiple frames in them (as is often the case). PNG files do work, as I have used them, but there may be an issue with colour depth, I think. I'll do some checking, but I have a feeling that 32bit didn't work for me.
0
AL_XResearchAuthor Commented:
If you could check please. To be honest I don't really care if the file is ICO or PNG - I would just like to create large (in the ribbon sense) and small ribbon images to progress my project.

I assume since the 'large' MS icons can also be used as 'small' buttons that they also have multiple frames (and therefore sizes) as is the normal way to create an ICO file.

If then it is just the editor that has problems with ICO files with multiple frames but the ribbon is fine with them then I am happy (if a little annoyed) to manually edit the XLAM file XML myself in notepad. To that end : do you know the correct adjustments to make to the <Relationship> elements in the 'CustomUI14.xml.rel' file ? I have been searching all over the net and cannot find it.

Many thanks for the timely responses.
0
Rory ArchibaldCommented:
I can't find a 32bit file to test on at the moment but have double-checked and 24bit works fine with PNG files. I'll do some testing with the .ICO files shortly.
0
Rory ArchibaldCommented:
The multi-frame .ico files seem to work fine - although to be honest I'm not sure what the benefit is of using them; regular images seem to scale pretty well to match the menu item size.

For the test I just added a dummy image file using CustomUI then added the real image file to the zipped file manually and altered the 'CustomUI14.xml.rels' file so that the Target="images/old_file_name.png" pointed to the new .ico file. I left the Id as it was to avoid having to go back and change anything else in the file.
0
AL_XResearchAuthor Commented:
Thats great, thanks. However it does not explain the GDI+ error in the editor.

If I need to manually adjust the XML then : what are the changes I need to make (or a <Relationship> markup example) to get the image stored in the subfolder 'images' to work ? I have looked all over the web and cannot find these.

If you use a PNG then : what is the colour depth allowed ? What is the maximum / recommended size ? I have see some websites that claim the max would be 255 but you seem to have found 50 works. Thew trouble with 50 is it does not give you a lot of canvas to be creative with - unless you start big and scale down.

Your advice much appreciated.
0
Rory ArchibaldCommented:
However it does not explain the GDI+ error in the editor.

That's because I can't explain it. From what I've seen it's not an inherent limitation in GDI+ but I didn't write the CustomUI editor so I can't speak as to its coding! ;)

If I need to manually adjust the XML then : what are the changes I need to make (or a <Relationship> markup example)

That was what I gave an example of. I can't see any reason to overcomplicate it by creating all the necessary relationships manually when you can let the CustomUI editor at least do some of the heavy lifting and all you need to do is alter the path. The basic syntax for that rels file would look like:

<?xml version="1.0" encoding="utf-8" ?>
- <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
  <Relationship Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="images/someIconFile.ico" Id="original_filename" />
  </Relationships>

I have successfully loaded a 24bit png image 2560 * 1920 pixels but from a file size point of view I wouldn't recommend it - it just gets scaled down anyway. According to this page: http://msdn.microsoft.com/en-us/library/windows/desktop/dd316921%28v=vs.85%29.aspx

the guidelines for Ribbon images generally are:

DPI      Small Image       Large Image
96 dpi      16x16 pixels      32x32 pixels
120 dpi      20x20 pixels      40x40 pixels
144 dpi      24x24 pixels      48x48 pixels
192 dpi      32x32 pixels      64x64 pixels
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AL_XResearchAuthor Commented:
<?xml version="1.0" encoding="utf-8" ?>
- <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
  <Relationship Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="images/someIconFile.ico" Id="original_filename" />
  </Relationships>
is exactly what I was looking for. I assume that there are no other amendments to be made to the other XML files ?

I am wondering if the reason I could not get a PNG to show on the ribbon before was the dpi, since I created a new graphic (PNG) of 64x64 192dpi and the icon showed ! I have yet to test loading a larger image and allowing Excel to scale it. Say 400x400 would give you enough room to be creative and create 3d effects / shading.
0
Rory ArchibaldCommented:
The id will have to match whatever id you have in the image attribute for your ribbon control in the CustomUI.xml (or CustomUI14.xml) but that's all.
0
AL_XResearchAuthor Commented:
Well it is not that since I am sure the ID in the ribbon and the ID of the loaded image's relationship are the same but I don't know why it didn't work.

When I created a 50x50 icon @ 192 dpi the icon showed fine. Perhaps it was the dpi that was causing the issue
0
AL_XResearchAuthor Commented:
This is exactly what I have been searching for !
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.