Free Support Forum -

UpdateFields generates incorrect TOC using .NET

My work is merge multi documents into one new document, and add a TOC .but when I use doc.AppendDocument(subDoc, ImportFormatMode.KeepSourceFormatting) method, as a result , the TOC missing the first document title, I need update it manually, and sub document title will waste a whole page. How can I fix it?

Hi Raphael,

Thanks for your query. Please call the UpdateFields() method before saving the document. If you still face problem, please share your documents for investigation purposes.

Thank you for your reply, but I still face problem. It is always losing the first document’s toc, I need to show it by F9 manually . I attach two sample documents, I want to merge them to an new document and add the TOC in the first page.

Hi Raphael,

Thanks for sharing the documents. I have managed to reproduce the same issue at my side. We had already logged this issue as WORDSNET-6069 in our issue tracking system. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

You can restrict TOC to the first level by using the following field code:

builder.InsertTableOfContents("\\o \"1-1\" \\h \\z \\u");

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-6069) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.