2 Replies Latest reply on Jul 1, 2010 5:50 PM by sdfasdfasdfa

    How to create index


      Source Code:


      var doc = app.activeDocument;

      var textFrame = doc.textFrames[0];

      var story = textFrame.parentStory;

      var insertP = story.insertionPoints.lastItem();

      var index = doc.indexes.add();

      var topic = index.topics.add("LCD","L");

      var pageR = topic.pageReferences.add(insertP);



      I want to insert symbol to the under of table,but it inserted to the first cell of table.

        • 1. Re: How to create index
          [Jongware] Most Valuable Participant

          That's weird.


          This worked, but I have no idea why:


          var pageR = topic.pageReferences.add(story.insertionPoints[-3]);


          because this adds it to the end of the story, but if you change it to [-4] the marker is inserted at the position you would expect (4 positions to the left of the end of story).


          The index markers are adjusted to the start of the word you're pointing to, but for some reason it fails. It must have something to do with the table, but I have no idea why.




          var pageR = topic.pageReferences.add(story.words[-1]);


          works again as expected.)

          1 person found this helpful
          • 2. Re: How to create index
            sdfasdfasdfa Level 1

            Thank you.