how i get the table of contents

hi,

how i get the table of content from a existing worddocument. I know how i can add one, but get. I want to update the page numbers.

I use syncfusion version 8.1.0.30.

thanks and regards
ladida


4 Replies

AS asdf October 28, 2010 11:49 AM UTC

ok, i must add a new table of content. But, how i can update it without press F9 or right click ... ?
Is there a methode they can do this?

regards,
ladida



PR Poornima R Syncfusion Team October 29, 2010 12:12 PM UTC

Hi ladida,

Thanks for your interest in Syncfusion products.

The Toc fields can't be updated by DocIO, it should be updated only after opened in MS word and by pressing F9 or select the fields and by giving update field. Since these fields values can't be set during document creation. The fields are only updated after opened by MS word.

We can only insert the TOC or other fields using DocIO.

As a
workaround
please use create one macro like give below in any of your word document. This will automatically updates when ever any documents opened. The AutoOpen macro automatically runs when the document opens.

Sub AutoOpen()
Dim aStory As Range
Dim aField As Field
For Each aStory In ActiveDocument.StoryRanges
For Each aField In aStory.Fields
aField.Update
Next aField
Next aStory
End Sub


Here is the link more about automatically updates fields

http://support.microsoft.com/kb/212703/


Please let me know if you have any questions.

Regards,
Poornima



AS asdf November 3, 2010 01:25 PM UTC

hi Poornima R,

thanks for your answer.

but I dont find a way to add a macro with docio.


And for future syncfusion versions: It would be very nice if your team add a method to update the table of content. Because I want to export it as .pdf, so no one can remove the watermark.

regards,
ladida



PR Poornima R Syncfusion Team November 4, 2010 09:32 AM UTC

Hi ladida,

Thank you for your update.

Currently Essential DocIO do not have the support for adding macro in a word document. We have already logged this as a feature request. Regarding "And for future syncfusion versions: It would be very nice if your team add a method to update the table of content", we have already logged this as a feature. We will consider this feature in any one of our future releases.

Please let us know if you have any questions.

Regards,
Poornima


Loader.
Up arrow icon