Make Table of Contents Entries Hyperlinks using .NET | Field.Update throws System.NullReferenceException

AsposeWordsNetIssue_datacase2.zip (7.5 MB)
Hello Aspose support,

We are using a licensed version Aspose.Words for .NET 20.10.0 to convert DOCX files to PDF. For one client datacase, the PDF conversion throws an exception when we remove hyperlinks from the Table of Contents (TOC) fields. If this code is commented out the PDF is created but the TOC in the PDF is wrong when compared to the TOC in the Word document (numbering are wrong). Problem occurs with version 21.8 of Aspose.Words for .NET as well.

Attached a .zip file containing the datacase and the code for a test program I wrote to demonstrate the problems. There are also instructions for how to build and reproduce the problem.

  • Unzip the contents to C:\Temp
  • Copy Aspose.Words.dll to the Assemblies folder (I had to remove this file to reduce size of upload)

Could you please letus know what can be done to fix these issues?

Thank you,
Dennis Abreo
dennis.abreo@bentley.com

@dennis.abreo

We have logged this problem in our issue tracking system as WORDSNET-22630. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

@dennis.abreo

Please accept document’s revisions before updating the TOC field as shown below to avoid the shared issue.

document.Revisions.AcceptAll();