Copy link to clipboard
Copied
Hello InDesign community,
I have a document with multiple different tables. I want to find and change all occurrences of one of the types of tables. If I use code <0016> in the Find What field under the Text tab, I have to use Find Next to get to each table individually so that I don't remove a different type of table. Is there a way to use this code and specify which tables to change? Or is there another way to do this without having to go one at a time?
Thank you!
Copy link to clipboard
Copied
Hi,
by scripting this is the way to get the special character that constitutes a table: <0016>
The table itself is "embedded" in this character. So if found the table can be accessed by: found[n].texts[0].tables[0] in ExtendScript code where n represents the number of the found text within the array of found text represented by variable found with Text Find.
You can search at the InDesign Scripting forum for use cases. There should be some:
Ah! Look for example at this one I wrote a couple of years ago:
NOTE: Both links do not work anymore.
Had to edit the code above, because it was damaged when this thread was moved over to the new InDesign forum by the end of 2019.
To address all found tables you have to loop through the tableCharacters array of this ExtendScript snippet.
In my example at the beginning of this post I named this array found. In the snippet I linked to its name is tableCharacters.
What would you like to do with a table when found?
Regards,
Uwe Laubender
( Adobe Community Professional )
EDITED
Copy link to clipboard
Copied
Hi pattig43169899 ,
just a follow-up on addressing tables.
Say, we have 10 tables in one story.
Two of them have 13 columns, all others only 12 or less.
If you want to change something in column 13 of the two tables you could do this in one go:
story.tables.everyItem().columns[12].cells.everyItem().fillColor = "Magenta";
Then you decide, that the fill color of every cell in the last column of all tables in that story should be "Yellow", you could do it with:
story.tables.everyItem().columns[-1].cells.everyItem().fillColor = "Yellow";
Regards,
Uwe
Copy link to clipboard
Copied
Hi together,
also look into my post from today:
Why? What? Enter < 0016 > or < 0017 > under the searched text to find the table?
Laubender
https://community.adobe.com/t5/indesign-discussions/why-what-enter-lt-0016-gt-or-lt-0017-gt-under-th...
One could refine the search to e.g. tables with 2 or more body rows only if you add <0017> to your Text Find pattern:
<0016><0017>
Or to tables with 3 or more body rows:
<0016><0017><0017>
I think, you'll get the pattern…
Regards,
Uwe Laubender
( Adobe Community Professional )