Wrong image showing up in worksheet


#1

I am using a stream to add an image to my worksheet and it is working fine. But when I create a second worksheet in a separate web request, the image from the first will show up in the second. This only seems to happen when I have excel already open with the first worksheet and then open the second from the browser. It does not happen if I select "save" instead of "open" in the browser dialog.

Here is the code I use to populate the image:

MemoryStream stream = new MemoryStream();

image.Save(stream, System.Drawing.Imaging.ImageFormat.Png);

worksheet.Pictures.Add(1, 1, stream);


#2

Could you please more of your code here? That will help me to figure out the problem. And which version are you using?


#3

Well, there really isn't much to it, the other code that I use would be to populate the data of my worksheet. I tried this with version 3.5.0 and 3.5.1 in .net

MemoryStream stream = new MemoryStream();

image.Save(stream, System.Drawing.Imaging.ImageFormat.Png);

worksheet.Pictures.Add(1, 1, stream);

excel.Save("thefilenamesarethesamewiththisproblem.xls", SaveType.OpenInExcel, FileFormatType.Default, context.Response);

context.Response.Flush();

context.Response.End();


#4

Another user reported a similar problem. I am working on this issue and will release a hotfix at the start of next week. Thanks for your patience.


#5

Please download and try v3.5.2 at http://www.aspose.com/Downloads/Aspose.Excel/.Net/3.5.2.0/Default.aspx .


#6

Thank You. It looks like this fixes the problem.