3 Replies Latest reply on Aug 28, 2017 9:23 AM by iamadamkennedy

    Updating TOCs [JS, CS3]

    ML Dean

      Hi all,


      In the InDesign interface, you can select your TOC and simply click Layout/Update TOC to update it.  Is this possible with a script or do I have to recreate the TOCs using the document.createTOC() method?  That's all I can find in the object model.


      I have a book with 33 chapters and each has its own table of contents.  All the tables have been set up, I just need to update them so they have the correct page number.




        • 1. Re: Updating TOCs [JS, CS3]
          [Jongware] Most Valuable Participant

          You looked in the right place, but might have overlooked this:


          Array of Story createTOC (using:TOCStyle[, replacing:bool=false][, fromBook:Book][, placePoint: Array of number][, includeOverset:bool=false][, destinationLayer:Layer])

          replacing (bool) If true, replaces the existing TOC. (Optional) (default: false)


          Sounds like all you need to add is


          document.createTOC([your toc style], true);

          1 person found this helpful
          • 2. Re: Updating TOCs [JS, CS3]
            ML Dean Level 1

            That's exactly what I needed.  Thanks!

            • 3. Re: Updating TOCs [JS, CS3]

              I have a script that does this in vb but am getting the strangest result. It runs and replaces my TOC, but the contents are blank. When I then select that same TOC frame and manually select Layout>Update Table of Contents, it updates and fills in the info.


              Here is my code.


              set myInDesign = CreateObject("InDesign.Application.CC.2015")
              myInDesign.ActiveDocument.CreateTOC myInDesign.ActiveDocument.TOCStyles.Item("QR TOC US"), True


              Any idea what might be causing this?