Skip to main content
sarfrazm7834471
Inspiring
December 5, 2015
Question

How to convert text to table in Indesign Script

  • December 5, 2015
  • 1 reply
  • 2354 views

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...

This topic has been closed for replies.

1 reply

Inspiring
December 6, 2015

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

sarfrazm7834471
Inspiring
December 7, 2015

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...

Inspiring
September 20, 2016

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.