get picture if I know its position in excel file ?

Questions and answers on how to use XLSReadWriteII 3/4/5.
Post Reply
TopWin
Posts: 3
Joined: Mon Mar 22, 2010 5:56 pm

get picture if I know its position in excel file ?

Post by TopWin »

Hi,
I would like to know how I can I use XLSReadWriteII 4 to get a picture from an excel file if I already know the position of the picture.
For example, If I know there is a picture in the cell A1, how can I get that picture and save it to disk ?
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: get picture if I know its position in excel file ?

Post by larsa »

Hello

A picture has column and row properties the defines it's position, so you can check if a it's in a cell.
Lars Arvidsson, Axolot Data
TopWin
Posts: 3
Joined: Mon Mar 22, 2010 5:56 pm

Re: get picture if I know its position in excel file ?

Post by TopWin »

hello larsa,
The position of pictures is described in the property XLS.Sheet[0].DrawingObjects.Pictures

But if I want to save a picture to a stream (or a file on hard disk), I have to use the property XLS.MSOPictures.

But there is no connection between these 2 properties, so I don't know which picture in XLS.MSOPictures is corresponding to which in XLS.Sheet[?].DrawingObjects.Pictures ?
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: get picture if I know its position in excel file ?

Post by larsa »

Hello

Yes, there is a connection between the two objects. Please study the WritePictures sample.
Lars Arvidsson, Axolot Data
TopWin
Posts: 3
Joined: Mon Mar 22, 2010 5:56 pm

Re: get picture if I know its position in excel file ?

Post by TopWin »

Could you please explain more ? Actually, before I posted this question, I have studied the WritePicture and ReadPicture samples.

In the WritePicture Sample, this is a very special case that you have just add a picture to MSOPictures so you can easily determine it as the last object in MSOPictures collection. This example also show that there is a connection between MSOPictures and DrawingObject.Pictures is the filename and the PictureName.

But in the ReadPictures sample, we can see that not every pictures has the filename property, maybe just an empty string!!!
Post Reply