Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Exporting images from an Excel woorksheet

Hi.

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.xlSc reen,
Excel.XlCopyPictureFormat.xlBitMap)
* get the image and save it from the clipboard (if Clipboard.ContainsImage()
is true)
= Clipboard.GetImage().Save(mystream,
System.Drawing.Imaging.ImageFormat.Jpeg)

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,

Pierre
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Exporting images from an Excel woorksheet

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

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm




"pierreg06" wrote in message ...
Hi.

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.xlSc reen,
Excel.XlCopyPictureFormat.xlBitMap)
* get the image and save it from the clipboard (if Clipboard.ContainsImage()
is true)
= Clipboard.GetImage().Save(mystream,
System.Drawing.Imaging.ImageFormat.Jpeg)

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,

Pierre

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Exporting images from an Excel woorksheet

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#) ?

Cheers.

Pierre



"Ron de Bruin" wrote:

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

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm




"pierreg06" wrote in message ...
Hi.

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.xlSc reen,
Excel.XlCopyPictureFormat.xlBitMap)
* get the image and save it from the clipboard (if Clipboard.ContainsImage()
is true)
= Clipboard.GetImage().Save(mystream,
System.Drawing.Imaging.ImageFormat.Jpeg)

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,

Pierre


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
exporting images from table JohnW Excel Discussion (Misc queries) 1 February 16th 09 10:50 AM
add-in, data in Add-in file (woorksheet) Jean-Marc[_2_] Excel Programming 2 October 3rd 07 04:26 PM
RS232 to Excel woorksheet Franz Excel Programming 4 February 21st 05 06:34 PM
How do I delete Rows from my woorksheet? Leslie Excel Worksheet Functions 8 December 15th 04 05:33 PM
Exporting images Bert[_3_] Excel Programming 1 December 13th 03 01:46 PM


All times are GMT +1. The time now is 03:58 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"