Free Support Forum - aspose.com

Table of Contents shows only the first Chapter afer UpdateFields

Hi,

i merge some worddocuments together and at the end i use:
renderedDocument.UpdateFields();
renderedDocument.UpdatePageLayout();

after Saving this Document to a doc file this docfile only contains only1 toc entry with the correct pagenumber. If i then press F9 to actualize the toc word shows then 2 toc entries.

Is there anything i missed? Do i need to do something else then UpdateFields and UpdatePageLayout to generate a complete TOC?

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. Could you please attach your input and output documents here for testing? I will check the problem on my side and provide you more information.

Best regards,

Hi here are the files

I merge
deckblatt + toc + chapter a + chapter b+ abschlussblatt to Bericht.doc

There are 2 Headlines, 1 in Chapter A and 1 in Chapter B. The ToC in Bericht.doc only shows the first. if i manually refresh the ToC in Word it shows the correct entries.

p.s.: the last Bericht.doc is the correct one. Remove File attachments doesn’t work for me.

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional information. This problem might occur because you use AppendDocument with ImportFormatMode.KeepSourceFormatting. Please try using ImportFormatMode.UseDestinationStyles, this should resolve the problem.

Best regards,