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)