none
Word Document Generation - Table of Contents RRS feed

  • Question

  • Hello,

    We have an application that generates a Word document (RTF).  At the beginning of the document is a Table of Contents that is not indexed so therefore does not show correct information.   To fix this, we manuall open the document in Word, hit CTRL-F9 (or whatever the hot key is to force the ToC to rebuild) and resave.

    This is not a good solution.

     

    Dev wants to install Office on the server and do the Ctrl-F9 thing through whatever means.   

    This must have some licensing issues!?!?!   How would we license this correctly?

    I think there must be a better solution.

    Is there a parameter we can save in the document that would force Word to rebuild the ToC when it gets opened?

    Is there an API/SKD we can use?

    How about I ask, what do you guys recommend we do so solve this?  Both for licensing and ease of implementation?

     

    Thanks!

     


    Dane!
    Wednesday, September 7, 2011 10:01 PM

Answers

  • Hi Dane

    1. There's nothing you can set in Word to force the TOC to update. You'd have to have a macro in the document named AutoOpen with the command ActiveDocument.TablesOfContents(1).Update. (Or if you have an add-in already running in Word, something could be done with that.)

    2. Office was never intended to be used server-side - there are issues (see  http://support.microsoft.com/kb/257757/en-us). As far as I know, if you have an end-user license for the application you can install and run it server-side. But it's not a supported scenario and MS advises against doing it.


    Cindy Meister, VSTO/Word MVP
    Thursday, September 8, 2011 8:39 AM
    Moderator