Free Support Forum - aspose.com

Can we pull up image from image object?

Hi

I have an Image in a memory stream object. Is there any way I can pull up image from this object and display in the excel sheet using Aspose. I have tried

sheet.Pictures.Add(3, 1,(Stream)memoryStream); where memoryStream is the MemoryStream Object. This is throwing an exception.

looking forward for your reply

Thanks

Hi,

What is the exception. Following is my code which works fine and attached is the output file.

//Create a new Workbook.
Workbook workbook = new Workbook();
//Get the first sheet.
Worksheet sheet = workbook.Worksheets[0];
//Get an image file to the stream.
FileStream stream = new FileStream("d:\\test\\west-block.jpg",FileMode.Open,FileAccess.Read);
//Add a new picture to the sheet
int i = sheet.Pictures.Add(3, 1,stream);
//Save the excel file.
workbook.Save("d:\\test\\tstpictures.xls");
If you still find the problem, please post your image file here.
Thank you.