GDI Error on SheetRender.ToImage

Hi,

I’m getting GDI+ error while trying to convert a xls file to Image using following code. File contains images and it’s size is 54 MB. You may download file from http://we.tl/rrqZeE9Zg0

Aspose.Cells.Workbook doc = new Aspose.Cells.Workbook(@“C:\GEODI_DATA\TCDD_2014\ankara_sivas\T9_documents\T-9G_R__T_NEL_YATAYSONDAJLOGU.xls”);
Aspose.Cells.Rendering.ImageOrPrintOptions imgOptions = new Aspose.Cells.Rendering.ImageOrPrintOptions();
imgOptions.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg;
imgOptions.OnePagePerSheet = true;
Aspose.Cells.Worksheet sheet = doc.Worksheets[0];
Aspose.Cells.Rendering.SheetRender sr = new Aspose.Cells.Rendering.SheetRender(sheet, imgOptions);
System.Drawing.Bitmap bitmap = sr.ToImage(0);

Thank you

Hi,


Thanks for your sample code and sharing template file.

After an initial test, I observed the issue as you mentioned by using your template file with your sample code. I found the following exception on SheetRender.ToImage method:
A generic error occurred in GDI+.
e.g
Sample code:

Aspose.Cells.Workbook doc = new Aspose.Cells.Workbook(@“e:\test2\T-9G_R__T_NEL_YATAYSONDAJLOGU.xls”);
Aspose.Cells.Rendering.ImageOrPrintOptions imgOptions = new Aspose.Cells.Rendering.ImageOrPrintOptions();
imgOptions.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg;
imgOptions.OnePagePerSheet = true;
Aspose.Cells.Worksheet sheet = doc.Worksheets[0];
Aspose.Cells.Rendering.SheetRender sr = new Aspose.Cells.Rendering.SheetRender(sheet, imgOptions);
System.Drawing.Bitmap bitmap = sr.ToImage(0); //Exception.

I have logged a ticket with an id “CELLSNET-43583” for your issue. We will look into it soon.

Once we have any update on it, we will let you know here.

Thank you.

Hi,


Please try our latest version/fix: Aspose.Cells for .NET v8.4.1.2

We have fixed your issue now.

Let us know your feedback.

Thank you.

The issues you have found earlier (filed as CELLSNET-43583) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Can you provide any details on the cause of the GDI error? Our application has been running with Aspose.Cells for .NET 7.7.1.0 for several months with no problems then started getting “A generic error occurred in GDI+.” errors on the call to SheetRender.ToImage a week ago.

I’d like to understand more about technical issue that was fixed before we apply 8.4.2.0 on our production servers.

Thanks

Hi,

Thanks for your posting and using Aspose.Cells.

Mostly this error occurs, when there are lot of pages e.g 10-100 or more and you try to render all of them in a single page i.e when you set OnePagePerSheet=true

To get rid of this error you should always check how many pages are inside sheet using SheetRender.PageCount property. If it gives you 10 or more pages then do not set OnePagePerSheet=true.

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan