3 Replies Latest reply on Sep 20, 2016 7:20 AM by jakec88782761

    How to convert text to table in Indesign Script

    sarfrazm7834471

      I imported xml File into inDesign file that contains tables....

      In inDesign document, I am getting the contents of a node, that contains table data with separator tab, but I am not converting this data into table.

      And I am not getting Rows (i.e. line separator).

       

      Can Anyone help me Please by giving the solution in JavaScript (JSX)

      Thanks...

        • 1. Re: How to convert text to table in Indesign Script
          BSKTCreation Level 2

          Hi there,

           

          Here's what I do for tab delimited text. It shouldn't be too difficult to convert your data to this otherwise you may have to edit your XML to include the table structure instead (which is a pain imo).

           

          app.activeDocument.textFrames[0].texts[0].convertToTable("\t","\r");
          
          

           

           

          Brett

          1 person found this helpful
          • 2. Re: How to convert text to table in Indesign Script
            sarfrazm7834471 Level 1

            Thanks for Response....

            Your Code is working if we have proper text with tabs & new line Characters.

            But, my text is:-

             

            "Table 10-1This is an Example of a Table TitleThis is a Table Subtitle 1. Lorem ipsum dolor amet consectetuer adipiscing option 2. Elit sed diam nonummy nibh magna suscipit euismod tincidunt ut laoreet dolore 3. Duis autem vel eum dolor in hendrerit a. In vulputate velit esse consequat duis dolore* b. Facilisi vel illum dolore eu feugiat 4. Nulla facilisis at vero eros et accumsan et iusto odio dignissim 5. Qui blandit praesent luptatum zzril augue duis dolore te feugait nulla delenit augue enim ad minim a. Consectetuer adipiscing nonummy nibh euismod b. Tincidunt ut laoreet dolore magna consectetuer adipiscing aliquam erat volutpat 6. Nisl ut aliquip vel eum iriure dolor placerat facer ipsum in vulputate hendrerit velit iusto odio dignissim qui blandit*Et accumsan et iusto odio nibh euismod tincidunt laoreet dolore magna aliquam erat."

             

            ==========>>:

            I am getting above text, I am able to get tabs but unable to get new line or line breaking characters,

            i.e. I am not getting Rows from this texts.

            May you help me please.....

            Thanks...

            • 3. Re: How to convert text to table in Indesign Script
              jakec88782761 Level 2

              The first parameter of the convertToTable() method is what is used to identify where you want a different column.

              The second parameter of the convertToTable() method is what is used to identify where you want a different row.

               

              If you were to say convertToTable("," "\t")

               

              You could have text that looked like this:

               

              hello,I am in a new column     Hello,I am on a new row

               

              It's dependent on how your text is formatted as to how you want the table to create your rows and columns.