How to calculate word pages?The calculated number less than real

How to calculate word pages?The calculated number less than real.

using Aspose.Words;
public static int getWordPage(string filePath)
{
    Document doc = new Document(filePath);
    int num = doc.PageCount;
    return num;
}

Hi there,

Thanks for your inquiry. The Document.PageCount property gets the number of pages in the document as calculated by the most recent page layout operation.

Please call the Document.UpdatePageLayout method and then use Document.PageCount property. Hope this helps you. If you still face problem, please attach your input Word document here for testing. I will investigate the issue on my side and provide you more information.

Thank you for your answer,but the problem still exist.

using Aspose.Words;
public static int getWordPage(string filePath)
{
    Document doc = new Document(filePath);
    doc.UpdatePageLayout();
    int num = doc.PageCount;
    return num;
}

attachment is the word document for testing.

Hi,

Thanks for your inquiry.

While using the latest version of Aspose.Words i.e. 14.6.0, I managed to reproduce this issue on my side. I have logged this issue in our bug tracking system. The ID of this issue is WORDSNET-10484. Your thread has also been linked to this issue and you will be notified as soon as it is resolved. Sorry for the inconvenience.

Best regards,

Thank you very much.I’ll wait for your good news.

The issues you have found earlier (filed as WORDSNET-10484) have been fixed in this Aspose.Words for .NET 24.1 update also available on NuGet.