Problems with numbered list and saving as pdf


it seems that update of numbered list within IF-field does not work, when document is saved as pdf.

In given example files there are two if fields that contain a text that is formatted as numbered list. Before saving the document all fields will be updated per document.updateFields().
If document is saved as docx everything is fine. Result is shown in ResultOk.jpg.
If document is saved as pdf the text is numbered incorrectly . Result is shown in ResultError.jpg.

Therefore I tested some variants and found the following solution. Using combination of document.updateFields() and document.unlinkFields() seems to solve the problem when saving to pdf.
Question: Is unlinking of fields really necessary or is it a bug?

In the end, I found another example that doesn’t work with the combination of document.updateFields() and document.unlinkFields() either.
If document contains a PAGE or NUMPAGES field in the footer the numbered list is incorrect again.


  • “ResultOk.png” (Numbered list ok)
  • “ResultError.png” (Numbered list is wrong)
  • “” (java file for saving to pdf)
  • “Test IfList WithOutPageField.dotx” (Word document with two if fields and nested numbered list)
  • “Test IfList WithPageField.dotx” (Word document with two if fields and nested numbered list and page-field in footer)

I am using the latest version of Aspose.Word (19.1)

Thanks a lot
Best regards
Matthias (82.7 KB)


Thanks for your inquiry. Please call the Document.UpdatePageLayout method before saving the document to PDF to get the desired output.

Hi Tahir,

it works fine in combination with updateFields and unlinkFields.

Thanks a lot


Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.

Hi Tahir,

sorry but i have to reopen this bug.
It seems that simply calling updatePageLayout() does not really solves the problem.
Calling updatePageLayout before saving will lead into an invalid numbered list in our example.
Calling unlinkFields directly before method updatePageLayout seems to work fine because the numbered list is valid now.
Unfortunately existing PAGE-fields are not updated correctly now -> The value of NUMPAGES-field is assigned to all PAGE fields.
Therefore calling unlinkFields is not possible. Do you have another possible solution.

Best regards


Thanks for your inquiry. We have not found NUMPAGES field in your input document shared in your first post. Could you please share your input document for which you are facing this issue?

Hi Tahir,

ok, here is an example to reproduce the problem. (123.3 KB)
The problem will occur if section break is used in word document, see “Test IfList WithPageField.dotx”

There are two generated pdf files included to illustrate the problem:
“Result with updatePagelayout and without unlinkFields.pdf”
“Result with unlink and updatePagelayout.pdf”

Thanks a lot.

Kind regards


We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-18309. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-18309) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by mudassir.raza