Error while initializing SheetRender

Hi.

I’m using SheetRender to retrieve the number of pages on a specific worksheet.
When calling new SheetRender(sheet, imageOrPrintOptions) for the sheet in the attached xlsx document an error is thrown.

Please help me solve this issue.

Thanks,
Dejan

Hi,


Thanks for your template file.

Please download and try this fix: Aspose.Cells for .NET (Latest Version) .

I have tested your scenario/case using your template file with it using the following code, it works fine:

Sample code:

Workbook workbook = new Workbook(“e:\test2\Example1.xlsx”);
Worksheet sheet = workbook.Worksheets[0]; //I also tried for the second sheet too, it works as well.

ImageOrPrintOptions imgOptions = new ImageOrPrintOptions ();
imgOptions.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg;

SheetRender sr = new SheetRender(sheet, imgOptions);

for (int j = 0; j < sr.PageCount; j++)
{
sr.ToImage(j, "e:\test2\mysheetimg " + j.ToString() + “.jpg”);

}


Thank you.

Hi,

Sorry, I accidentally cleaned the file too much. This is the right file. The large amount of data from column LI (row 62) till the last column is the reason for the error.


Hi,


Please try our latest version/fix: v7.5.3.1 as I requested you to try it in my previous post.

I did test with your newly attached file, I think it works although it would take lots of time and resources (RAM) to complete the process. I used my sample code pasted in my previous post. I did not complete the process as it would generate 9112 or more images for the pages (some pages are blank too.). For your information, if you could open the file into MS Excel and take the print preview of the first sheet, you would notice that it has 9112 pages in total, so surely, this would demand lots of memory and resources to render all the pages of the sheet, also it would take sometime depending upon your system and resources.

Note: I have to stop the process after some minutes as it would generate unnecessary blank images and fill up my hard disk drive (and by that time, it has generated more than 8000 images for the sheet pages mind you).

Thank you.

Hi

I know it takes some time to generate the images. I didn’t interrupted the process and on page 9110 I got this exception (also with your latest version/fix):
System.ArgumentException occurred
HResult=-2147024809
Message=Invalid column index.
Source=Aspose.Cells
StackTrace:
at . . (Int32 )
at Aspose.Cells.Cells.GetColumnWidthPixel(Int32 column)
at . . (Cells , Int32 , Int32 , Boolean )
at . . ()
at . . (Worksheet )
at . . (Worksheet )
at . . (Int32 )
at . . (Worksheet , ImageOrPrintOptions )
at . . (Worksheet , ImageOrPrintOptions )
at Aspose.Cells.Rendering.SheetRender…ctor(Worksheet worksheet, ImageOrPrintOptions options)

I solved my issue by removing the unnecessary data which was accidentally inserted in the file. So now, this is only an corner case example for you if you want to fix it in one of the next releases.

Thanks for you help

Hi,


Good to know that it works for you after deleting your unnecessary data in the pages.
And sure, we will investigate the issue i.e. “System.ArgumentException exception on 9110 page” on our end. I have logged a ticket with an id “CELLSNET-42002” for your issue. We will look into it soon.

Thank you.

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


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

@Amjad_Sahi : hi i am still facing the above issue when i am initializing SheetRender in version 19.7

@dewan.ishi,

Please provide your sample code (runnable) with template file (if any) to reproduce the issue. we will check it soon.