SheetRender constructor does not return when opening a very large spread sheet

Is there another way to get the page count of a spread sheet, other than using SheetRender? On a very large sheet, 16,366 columns by 1,048,482 rows SheetRender appears to hang with no error returned. It appears to render the entire sheet. What is the max sheet size supported?

Aspose.Cells for .Net version 19.8.0.0.

@HylandRendering,

If you have such a large sheet in the workbook, there will be billions of pages to be rendered which requires more resources (CPU, memory) and can take lots of time too.

You may get the printing page breaks using Worksheet.GetPrintingPageBreaks.

 ImageOrPrintOptions printoption = new ImageOrPrintOptions();
            printoption.PrintingPage = PrintingPageType.Default;

CellArea[] area = worksheet.GetPrintingPageBreaks(printoption);
            MessageBox.Show(area.Length.ToString());

There is no limit on it. Aspose.Cells follows MS Excel standards and specifications. So, if you could open such a file (with huge list of pages) into MS Excel manually, MS Excel itself will take much time to open into it.

@HylandRendering,

We also have more effective approach to get the total number of pages without initializing/using SheetRender API.
e.g
Sample code:

........
ImageOrPrintOptions options = new ImageOrPrintOptions();
            options.PrintingPage = PrintingPageType.Default;

SheetPrintingPreview preview = new SheetPrintingPreview(worksheet, options);
            int pageCount = preview.EvaluatedPageCount;
.....

Hope, this helps a bit.

Yes it did help. Got the page count much faster. and did not consume a lot of memory.

We also use SheetRender to convert a single sheet to an image. Getting a new SheetRender object for our very large sheet is not practical, takes a very long time and consumes most all memory on the system. And I noticed memory is not released until the process stops which is a big problem for an IIS aplication. The app pool has to be recycled.
Is there also another way to convert to image with out SheetRender.

Thanks
Code:
int bookPageCount = 0;
foreach (Worksheet sheet in asposeDoc.Worksheets)
{
SheetPrintingPreview preview = new SheetPrintingPreview(sheet, imgOptions);
int pageCount = preview.EvaluatedPageCount;
SheetRender sr = new SheetRender(sheet, imgOptions);

                    if (bookPageCount + pageCount > _conversionProperties.PageIndex)
                    {
                        int index = _conversionProperties.PageIndex - bookPageCount;
                        sr.ToImage(index, _reformattedStream);
                        break;
                    }

                    bookPageCount += pageCount;
                }

@HylandRendering,

No, there is no other way but to use SheetRender API to render the image(s) of the sheet.

Please provide template file (you may zip the file prior attaching) and we will check if we could get the performance issue. If we found the issue, we will log appropriate ticket to figure it out soon.

Thanks for looking into this. There is a value in Row 1048483, Column XEM.

HylandRendering_test file.zip (193.0 KB)

@HylandRendering,

I checked your file in MS Excel manually. I spotted there are billions of pages (mostly pages are blank (after page33 or so)) when taking the print preview of the sheet for the range A1:XEM1048483. So, you can imagine how much time, CPU and memory would be required to render this huge list of pages by SheetRender APIs. I guess the time consumption is ok for rendering billions of pages. Why you are rendering the blank pages? You may easily cope with it by setting the attribute for ImageOrPrintOptions. See the sample code for your reference:
e.g
Sample code:

var imgOptions = new ImageOrPrintOptions
{

            PrintingPage = PrintingPageType.IgnoreBlank,
            ImageFormat = ImageFormat.Png
            
        };

Alternatively, you may try to use the following lines of code to remove blank rows and blank columns:
e.g
Sample code:

//Delete the Blank Rows from the worksheet
                    sheet.Cells.DeleteBlankRows();
                    //Delete the Blank Columns from the worksheet
                    sheet.Cells.DeleteBlankColumns();

Hope, this helps a bit.

Thanks Amjad, those suggestions worked out well. Thanks!

@HylandRendering,

Good to know that the suggested approaches works for your needs. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.