We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Getting number of pages of excel file

Hi,
I would like to get the total number of pages that would be printed out of the excel sheet.

I am trying using the below code , but everytime I get output as 0.

BuiltInDocumentProperties buildInDocumentProperties = workbook.getWorksheets()
.getBuiltInDocumentProperties();

buildInDocumentProperties.getPages();

Am i doing something wrong ?

Attached is the xls file.

Hi,

In fact 0 is the default value for this property because there is no such an explicit value defined in given template files. And we don’t think it is a reliable way to detect the printed page number because this property may not be defined for most of excel files. We think you can try SheetRender.getPageCount() for your purpose.