1 Reply Latest reply on Dec 16, 2014 6:08 PM by TᴀW

    How to format paragraphs in a table cell programmatically

    Bill McLean Level 1

      I am adding three paragraphs to a cell:

       

      this.currentTable.rows[0].cells[0].contents =

        record[this.GUIDE_LOCNAME_ENG] + "\r" +

        record[this.GUIDE_LOCNAME_FR] + "\r" +

        record[this.GUIDE_LOCDESC] +"\r" +

        record[this.LATITUDE] + "N " + record[this.LONGITUDE] +"W";

       

      I am still relatively new to the InDesign model and my head hurts

       

      I want to access the paragraphs and change the paragraph style of each paragraph to three different paragraph styles. I have searched and I am stymied.

       

      Thanks in advance

       

      Bill

        • 1. Re: How to format paragraphs in a table cell programmatically
          TᴀW Adobe Community Professional & MVP

          I count 4 paragraphs there! Anyway, once you've added the contents to

          the cell, it should be a simple matter of:

           

          para1 = this.currentTable.rows[0].cells[0].paragraphs[0];

          para2 = this.currentTable.rows[0].cells[0].paragraphs[1];

           

          etc.

           

          then, to apply a paragraph style:

           

          myParaStyles = app.activeDocument.paragraphStyles;

          para1.appliedParagraphStyle = myParaStyles.itemByName("aStyleName");

          etc.

           

          (If you para styles are in groups, you need to target the group first

          before the paragraph style).