Aspose Word Page Count Evaluation Timeout

Hello, I’m using Aspose 20.10 and was processing a word document. I’m accessing the PageCount property from Aspose.Words.Document. For this particular document, it is giving me “Evaluation timed out” error. And once this property is accessed the program will just freeze there and will never go to the next step or even enter the Catch statement for an exception.
However, if I put a breakpoint a couple of steps prior to calling this property and take some time while debugging, it will load the page count and will proceed without any issues. I have attached the screenshot of the error.
I tried to write a short code replicating the issue to send it to you, but I’m not able to replicate the exact same issue in my other code. However, I was getting “Evaluation Timed Out” for another property named - ‘Hasrevision’. I’ve attached the document which is giving me the error as well.
Could you please let me know what could be the reason for this kind of error and what is the resolution for this?

FR 2022-28451_3711762 (1).docx (133.7 KB)

@vasudevan When you access Document.PageCount property Aspose.Words internally calls Document.UpdatePagePayout() method, which is quite time and resources consuming operation, since it rebuilds whole document layout. You can call Document.UpdatePagePayout() explicitly before accessing this property in the debugger.

Hi, I tried calling Document.UpdatePageLayout() explicitly before calling the PageCount in the debugger and the program gets stuck forever in the Document.UpdatePageLayout() itself. But if I try removing the footer of the document thru Word or using Aspose (right before calling this property), then I won’t have any issues and the document will pass thru the PageCount property. Is there a way you could debug and see what is wrong with the footer/formatting of the footer or the formatting of the document because of which the PageCount property is failing? I am attaching the document with this thread.
Also, could you please let me know what property can I use to reset the formatting of a word document to a normal text document? For example, in word, I select all the contents of the document and use Ctrl + Shift + F9. Any property that I can use to perform the same using Aspose?

eDoc_2022-28451_eDocFile_FR_2022-28451_3711762_(1)_Work_File_3718113.docx (129.4 KB)

@vasudevan Unfortunately, I cannot reproduce the problem on my side. Document.UpdatePageLayout() does not hang on my side. I use the latest 23.1 version of Aspose.Words for testing. As I can see you are using quite old version, so please try updating to the latest version.
You can request a free temporary 30-days license to test the latest version on your side without evaluation version limitations.

Ctrl+Shift+F9 is Unlink fields combination in MS Word - converts all qualifying fields in the selection into hard text; once this action is done, the field can’t be updated any more. You can achieve the same by calling Document.UnlinkFields method to unlink all fields in the document, or Field.Unlink method to unlink an individual field.

Is there any way you could process this document in the 20.10 version of Aspose and see if you could replicate the issue or find anything weird with the document? At this point, I’m not sure if our team is willing to upgrade the Aspose. Meanwhile, I will try to process this document with the latest version of Aspose and will let you know if I still have the same issue.

@vasudevan Yes, the problem is reproducible on 20.10 version of Aspose.Words. It looks like the issue WORDSNET-21076, which was fixed in the next 20.11 version. The issue was related to layout of footnotes. So removing the footnotes from the document fixes the problem:

Document doc = new Document(@"C:\Temp\in.docx");
doc.GetChildNodes(NodeType.Footnote, true).Clear();
doc.UpdatePageLayout();
Console.WriteLine(doc.PageCount);
doc.Save(@"C:\Temp\out.pdf");

What is the expiration date of your Aspose.Words license? Every Aspose license provides a 1-year subscription for free upgrades to any new Aspose.Words version that comes out.
You can check when your subscription expires - just open the license file in Notepad (but take care not to modify and save the license file or it will no longer work) and see the SubscriptionExpiry field.

<SubscriptionExpiry>20220218</SubscriptionExpiry>

It means that you can free upgrade to version of Aspose.Words published before 02/18/2022.
If your license expiration date is greater than November 09, 2020 you can update to 20.11 version for free.

Thank you for your response. Could you please provide me the release notes for the latest Aspose version? We want to check what changes are we going to get when we upgrade from 20.10 to the latest version. If possible, please provide me the release notes for 20.11 as well.
FYI the Subscription expiry date for our current license is 10/26/2021.

@vasudevan You can find our release notes here:
https://docs.aspose.com/words/net/aspose-words-for-net/

With your license you can update to 21.10 version of Aspose.Words for free.

Hi, I am trying to upgrade Aspose to version 21.10 as recommended but some of the properties that I was using in my program are giving me errors with the newer version of Aspose. It looks like these properties were replaced with newer ones. Could you please help me with what methods can I use as a replacement for those?

  1. Aspose.Words.LoadOptions();
  2. Aspose.Words.Footnote
  3. Aspose.Words.FindReplaceDirection.Forward

I’m getting an error saying those types or namespaces does not exist in the namespace Aspose.Word namespace.

@vasudevan The mentioned classes and enums has been moved to separate namespaces:

  1. Aspose.Words.LoadOptions —> Aspose.Words.Loading.LoadOptions
  2. Aspose.Words.Footnote —> Aspose.Words.Notes.Footnote
  3. Aspose.Words.FindReplaceDirection —> Aspose.Words.Replacing.FindReplaceDirection