Invalid page count from SheetRender

Hello,

I’m trying to find the page count of the attached xlsx file using Aspose Cells v19.8 for Java
MS-Excel print preview shows 4088 pages for this file.
However, the SheetRender.getPageCount() gives 4256 pages.
The interesting part is that, the SheetRender.getPageCount() gives me 4088 pages (correct page count) after doing some operations on every rows in the sheet.

Can you please run the below sample code on the attached test file

  Workbook wb = new Workbook("C:/Ash/test.xlsx");
  Worksheet ws = wb.getWorksheets().get(0);
  ImageOrPrintOptions options = new ImageOrPrintOptions();

  SheetRender sr = new SheetRender(ws, options);
  System.out.println("Page Count: "+sr.getPageCount()); 
  
  RowCollection rows = ws.getCells().getRows();
  for (int i=0; i< rows.getCount(); i++)
  {
     rows.get(i).getFirstCell();
  }

  SheetRender sr2 = new SheetRender(ws, options);
  System.out.println("Page Count: "+sr2.getPageCount());

You can see the output shows two different page count for the same file. The first time it gives wrong page count where as the second time it gives the correct page count.

If you remove the for loop logic in the above program, then the page count is still invalid even for the second time.

Can you please help me in this regard. I want to retrieve the correct page count without having to process all the rows in the sheet.

test.zip (6.7 KB)

@askgowda,

I noticed the issue as you described using your sample code and template file. We need to investigate the issue thoroughly to figure it out. For this, I have logged a ticket with an id “CELLSJAVA-43016” for your issue. We will look into it soon.

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

PS. by the way, I also spotted many blank pages in your worksheet (with only 4 pages having data/style), so may be you could try to use the following line to render only valid pages:

options.setPrintingPage(PrintingPageType.IGNORE_BLANK);

@Amjad_Sahi
Thanks

@askgowda,
This is to inform you that we have fixed your issue (logged earlier as “CELLSJAVA-43016”) now. We will soon provide you the fixed version in paid support forum thread after performing QA and incorporating other enhancements and fixes.

@askgowda,

Please try our latest version/fix: Aspose.Cells for Java v19.10.1:

Aspose_Cells_Java_v19.10.1.zip (6.6 MB)
Your issue (logged earlier as “CELLSJAVA-43016”) should be fixed in it.

The issues you have found earlier (filed as CELLSJAVA-43016) have been fixed in Aspose.Cells for Java v19.11. This message was posted using Bugs notification tool by ahsaniqbalsidiqui