Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

Adding dataMergeTextPlaceholders to table cells

Return to Forums

  • Author
    Posts
    • #100030

      Hi All

      This post is a repeat of one I’ve submitted in the InDesign scripting forum at adobe.com so I apologise for that, however I’m casting a wider net in the hope of solving something that has had me stumped for a few days now…

      Although I have had great success in automating report creation using scripting and InDesign’s data merge function with simple text frames, I am having no success in getting dataMergeTextPlaceholders into table cells using scripting.

      I tried to add one using the following code (considerably simplified from my actual code):

      myStory = myTable.rows[0].cells[0].texts[0].parentStory; // hopefully the Story for the first cell in the table?
      myStoryOffset = myStory.insertionPoints[-1];

      myDataMergeField = getDataMergeField(fieldName, myDocument);
      myFieldHolder = myDocument.dataMergeTextPlaceholders.add(myStory, myStoryOffset, myDataMergeField);

      However the result of that was to add the field to the parent text frame of the table, i.e. entirely outside the table
      When I do this manually in InDesign I don’t need to create any additional text frames, I can just add the placeholder directly into the cell, so I wouldn’t expect to have to do much more than correctly address the location (in terms of the Object Model hierarchy) of the table cell content.

      So, to sum up my situation:

      I can successfully add dataMergeTextPlaceholders to text frames.
      I cannot add them to table cells, as I can’t work out how to get to the ‘Story’ associated with the table cell content.

      Any assistance will be appreciated :)
      Regards
      Mick

    • #100053
      Anonymous
      Inactive

      To anyone in need, here is a link towards a possible answer:

      https://forums.adobe.com/thread/2419412

      • #100054

        You got here before me to post the link to the solution :)
        Thanks again.

        Mick

Viewing 1 reply thread
  • You must be logged in to reply to this topic.
Forum Ads