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.


#5

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
Matthias


#6

@curmas

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?


#7

Hi Tahir,

ok, here is an example to reproduce the problem. AsposeBug2.zip (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
Matthias


#8

@curmas

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.