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.
Jongware, after seeing your code i say WOW!
then i tried this:
app.activeDocument.textFrames.everyItem().tables.everyItem().convertToText("\t","\r");its your code but in a single line....Shonky
Well, that's even better!
I wonder why this even works -- what kind of object(s) is/are returned by everyItem()? Using 'constructor.name' returns the name of a single instance; it's certainly not an array. And, as I was very surprised to notice, it works on all items at once, and leaves only a single Undo on the undo stack. Way, way better than "the usual way", looping over all stories and all tables inside each story, but .. why?
everyItem() (as well as itemByRange() returns a very weird object. If
you are using it to find a table (for example) it returns a table
object which has arrays as properties instead of the normal
properties. The array is the properties of the objects which are
represented. That's why you can set all the properties (or methods) on
these special objects. It takes some time to get your head around the
objects returned by everyItem(). If you plan to use them as an array,
you need everyItem().getElements(). (Which returns the objects as an
array of regular objects.)
Innovations in Automation
Is much better for two reasons:
- Overset text does not have a parent text frame.
- 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...
Apologies for resurrecting this year old thread but I'm liking the idea of being able to convert a whole document of tables to text but I'm not that knowledgable on the scripting side.
Would someone kindly please show me on how to apply the last post's (Harb's) code into a workable script please?
Just copy and save as a jsx file...
So simple.... I feel like a fool now
Many thanks though!
I've just added this script but wondered if there was a way if preserving the paragraph styles when removing the tables? I have a document with many tables but about half a dozen paragraph styles in place, and when I remove the tables the text all reverts to one (the first one used in the table)?
i want to convert text Frame to text Fields for making interactive Pdf so can help me pls..