Free Support Forum - aspose.com

Problems with numbered list and saving as pdf


#1

Hi,

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.

Attachements:

  • “ResultOk.png” (Numbered list ok)
  • “ResultError.png” (Numbered list is wrong)
  • “TestIfList4Aspose.java” (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

AsposeBug.zip (82.7 KB)


#2

@curmas

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


#3

Hi Tahir,

it works fine in combination with updateFields and unlinkFields.

Thanks a lot
Matthias


#4

@curmas

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