Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to convert text to table in Indesign Script

Explorer ,
Dec 05, 2015 Dec 05, 2015

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

TOPICS
Scripting
2.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 05, 2015 Dec 05, 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 06, 2015 Dec 06, 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...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Sep 20, 2016 Sep 20, 2016
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines