Hi All,
I want to select all the tables in a document and it needs to be anchored. Is that possible?
For figures, using grep option "~a" I can achieved my task, how can I proceed for tables. Please help.
Vandy
Hi Vandy. What do you want to do with tables? Choosing anchored objects (picture frames) with grep does not allow you to change any object atributes itself (frame fill color, object style, stroke width etc.) but just those which are typographic - baseline shift, leading, ... . Am I right? I suppose it is the same by tables - even anchored tables are not found by GREP search. So changing typo attributes inside table should GREP do either they are anchored or not and changing the other ones I would do with defining table styles.
Jura
Hi,
tables belong to stories and there position is marked by the storyOffset, which is an insertionPoint (1).
So you can add a new textFrame (anchored) there (1) and move the existing table to insertionPoint[0] of this new textFrame.
There will be a lot of circumstances to keep an eye on ... complicated ![]()
Hans-Gerd Claßen
@vandy88 – you could look at the "storyOffset" property of all tables. That gives you a different "insertionPoint" object for every Table. Take the Index number of that "insertionPoint", subtract 1 and you have the Index for the Character that represents the table in the story.
Then you could move that character with the "move()" method to an anchored TextFrame, if that is what you want.
Here an example with one text frame that holds one table (and nothing more) in an InDesign file:
var d=app.documents[0];
var myTableCharacter = d.stories[0].characters[d.stories[0].tables[0].storyOffset.index-1];
var newTextFrame = d.textFrames.add({geometricBounds:[0,0,100,100]});
myTableCharacter.move(LocationOptions.AFTER,newTextFrame.texts[0].insertionPoints[0]);
Hope, that gives you an idea.
Uwe
@vandy88 – in theory you could use the GREP search for the task to identify the special character that represent a Table object in a Texts object.
The special character that represents a Table is "\u0016". But unfortuantely it seems, that it's not supported by the UI or the scripting alternative of Adobe GREP. (Correct me, if I'm wrong. I tested with InDesign CS5.5 7.5.3)
Say, for example, we have one single Table in the document and the text frame that holds the Table is selected, the following code snippet results to "0":
app.findGrepPreferences = app.changeGrepPreferences = null;
app.findGrepPreferences.findWhat = "\u0016";
var myTableCharacters = app.selection[0].texts[0].findGrep();
$.writeln(myTableCharacters.length);
//Result: 0
Wheras a regEx (in contrast to the Adobe GREP) can identify a "\u0016" in the contents of a Texts object.
Select the text frame with the Table and run the following code:
var myContents = app.selection[0].texts[0].contents;
var myRegEx = /\u0016/;
myRegEx.test(myContents);
//Result: true
The result is "true". The special character is identified…
Uwe
@Jongware – yeah, might be. But why?
Nonetheless, if you do a Text Search with "<0016>" you easily can get the Table object of its found character representation:
app.findTextPreferences.findWhat = "<0016>";
var tableCharacters = app.documents[0].findText();
//The first Table that the Text Search has found:
$.writeln(tableCharacters[0].texts[0].tables[0]);
Uwe
North America
Europe, Middle East and Africa
Asia Pacific