InsertTableOfContents

Im confused how InsertTableOfContents is suppsed to work.
I think ive followed it correctly and done the following:-

docBuilder.MoveToDocumentStart();
docBuilder.MoveToMergeField("Contents");
docBuilder.InsertTableOfContents(@"\o ""1-3"" \h \z \u"); 

however when i open the document there is no TOC - ive read something about you will not see the TOC when you open the document? buy why? and who do i make it so i can.
thanks
adrian - newbie to aspose.word.

You need to update fields when you open the document in MS Word. Select all (Ctrl+A) and press F9.

can this be done progamatically cia the api?
thanks
adrian.

In MS Word Automation there is something like Document.UpdateFields or Range.UpdateFields.
We also have Range.UpdateFields, but it cannot recalculate the TOC yet. Aspose.Word will eventually be able to do that. Several month away.

>>Aspose.Word will eventually be able to do that. Several month away
I have inserted a TOC in my document and saw everywhere that I need to open the document and do CTRL-A and F9 to be able to see it.
The comment above written in 2005 suggests that this feature was to be done at that time. Now that we are in 2008, is it possible to automatically see the TOC?
Also, the TOC is not generated when saving as a PDF or HTML. Is there anything to do to get something like this?

Hi
Thanks for your request. Unfortunately Aspose.Words can’t update TOC fields. As workaround you can use a macro to automatically update the field. See the following link for more information.
https://support.microsoft.com/en-us/topic/the-filename-field-does-not-automatically-update-when-you-open-a-document-in-word-de2bfb95-d990-1ced-a618-5ac0a2ec1be4
Best regards.

Hi
I am not starting from a template document. Can Aspose.Words insert a AutoOpen macro into the generated document?

Hi
No, Aspose.Words can’t insert macro into the document. But I think that you can use empty document as template (document that contains AutoOpen macro).
Best regards.