We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Update Table of Contents (TOC) & Form Fields & Convert DOCX Word Document to PDF using C# .NET | Accept All Revisions

Hi there,

We are using Aspose.Words for .NET version 20.3 to convert document files to PDF and and one of the steps will update all the form fields inside the document using the line:

        doc.UpdateFields();

The entire conversion to PDF code is:

        var doc = new Document(input);

        doc.LayoutOptions.TextShaperFactory = HarfBuzzTextShaperFactory.Instance;

        doc.AcceptAllRevisions();

        doc.UpdateFields();

        doc.UpdatePageLayout();

        var saveFormat = new PdfSaveOptions
        {
            OptimizeOutput = true,
            ImageCompression = PdfImageCompression.Jpeg,

            PreserveFormFields = true,

            UpdateFields = true,
            SaveFormat = SaveFormat.Pdf
        };

        doc.Save(output, saveFormat);

We found a document that will get an incorrect Table of Contents that basically is the entire document all over again.
Manually updating the entire ToC in Word will have the expected result.

Here are the input and the output file: toc_issue.zip (148.2 KB)

Thank you!

@gwert,

We managed to reproduce this issue on our end even by using the latest (20.6) version of Aspose.Words for .NET. We have logged this issue in our bug tracking system. The ID of this issue is WORDSNET-20678. Your thread has been linked to this issue and you will be notified as soon as it will get resolved in future. Sorry for the inconvenience.

The issues you have found earlier (filed as WORDSNET-20678) have been fixed in this Aspose.Words for .NET 20.8 update and this Aspose.Words for Java 20.8 update.