Free Support Forum -

Can we pull up image from image object?


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



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.
If you still find the problem, please post your image file here.
Thank you.