Skip to main content
New Participant
February 17, 2010
Question

Convert Table to Text Script

  • February 17, 2010
  • 1 reply
  • 12762 views

Does anyone know if there is an Indesign script that will convert all tables in a document to text? I need a fast way to get rid of all tables in a long document before exporting for Digital Editions.

1 reply

Inspiring
February 17, 2010

Check this one:

http://forums.adobe.com/message/1951975#1951975

Shonky

Jongware
Community Expert
February 17, 2010

The script mentioned in there is not complete -- it works, but on the first table only. This one works, to my own surprise:

var myDoc=app.activeDocument; 
tableList = myDoc.textFrames.everyItem().tables.everyItem();
tableList.convertToText("\t","\r");

-- it's not really much longer than the original, appears to work almost instantly on all tables in the entire document, and it's a single Undo/Redo.

Goes to show I've still a lot to learn.

Known Participant
August 20, 2019

FWIW,

app.activeDocument.stories.everyItem().tables.everyItem().convertToText("\t", "\r");

Is much better for two reasons:

  1. Overset text does not have a parent text frame.
  2. Anchored text frames (or tables nested in some other way) are not a child of a page (or the document for that matter either).

Neither method will handle teables nested in tables, or in footnotes very well...

Harbs


hey, thanks for the code Harbs--- this seems very handy
Now is there a way to get it to apply only to single cell tables?

I work with a lot of documents imported from word, it imports multi cell tables, which is nice. but all things that look like text boxes in word it turns into single cell tables in indesign, which is annoying. Would be much cleaner if I could convert them all to text boxes in one go. any ideas?