How to add an image stream to excel?

Hi,

Please tell me how I can add an image stream to excel.

I have used this overload earlier

worksheet.Pictures.Add(30, 6, 50, 13, "C:\\Documents and Settings\\All Users\\Documents\\My Pictures\\Sample Pictures\\Water lilies.jpg");

Now I need to get the image as a stream and then insert it into excel. First , how do I convert it to a stream? I think if this is cleared I can use the worksheet.Pictures.Add(upperleftrow,upperleftcolumn,stream) overload? Please tel me how I can go about this.

Regards

Soumya

FileStream stream = File.OpenRead(“C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Water lilies.jpg”);

I tried this one already, it works. But when I Try loading the image into a filestream, getting the bytes, writing to a memorystream and then embedding into Excel, it does not work. Memory stream is not appropriate?

Please try this attached version with following sample code:

Workbook wb = new Workbook();
FileStream fs = File.OpenRead("d:\\logo.jpg");
byte[] array = new byte[fs.Length];
fs.Read(array, 0, array.Length);
MemoryStream stream = new MemoryStream(array);
wb.Worksheets[0].Pictures.Add(0, 0, 2, 2, stream);
wb.Save("d:\\test\\abc.xls");