Exporting images from an Excel woorksheet




I try to extract (C#) all the pictures embedded in a worksheet by:
* walking thru all the shapes embedded in the current worksheet
* copy the shape into the clipboard
=> Myshape.CopyPicture(Excel.XlPictureAppearance.xlScreen,
* get the image and save it from the clipboard (if Clipboard.ContainsImage()
is true)
=> Clipboard.GetImage().Save(mystream,

This works pretty well, excepted that image resolution in the saved files is
poor. For instance, all the images inserted in the Excel Worksheet are around
40k and the file saved are around 4k.

Whatever is the format of my initial images (.jpg, .bmp), I always get a
very low resolution.

Is there anyway to cope with this problem ?
Is there another way to extract images without using clipboard ?

Many thanks in advance for your help,


Ron de Bruin

I like to save the workbook as a html file
It will create a folder for you with all the pictures


Thanks Ron for this information.

I unfortunatly cannot use this trick because I need to correlate the images
with a "name" (which is manually inserted on each image as "replacement text"
property, in Web tab/Image Format). I use Excel 2003.

Anyway, I noticed an interesting thing: when I save the worksheet as an html
file, each picture is duplicated:
* one has the right size (that is the real size of the source image inserted
in the Excel file)
* the other one get the "offending" reduced size

Does any body has an idea on how to get the pictures with the real size,
programmatically (in a plugin written in C#) ?



Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question