I was wondering if I could use Aspose.Word and Aspose.excel to get the number of pages in word and excel document respectively. Aspose.Word gives me a different page count than the actuall when I try to read it from the Document Properties.
I tried using aspose.excel to ge the number of pages using this formula:
Num of Pages = (HPageBreaks.Count + 1) * (VPageBreaks.Count + 1)
This always returns me Page count of 1; not sure if I am doing it in the right way.
Could anyone please let me know? I am in the process of evaluating this tool.
Excel Code Sample:
Aspose.Excel.Excel excel = new Excel();
Worksheets sheets = excel.Worksheets;
Worksheet sheet = sheets;
int hpage = sheet.HPageBreaks.Count + 1;
int vpage = sheet.VPageBreaks.Count + 1;
int pagecount = hpage * vpage;
MessageBox.Show("Number of Pages: " + pagecount.ToString());