Skip to main content
Phil 815
Inspiring
April 19, 2023
Answered

How to get coordinates of table column or cell

Hi, I've been searching for a way to get the coordinates of a table column or cell. The reason I need this data is that I want to place another object inline with a specific column/cell. I've seen some forums discussing the idea of using createOutlines() to tempoarily create an outline that I can use for it's geometricBounds property, but that doesn't seem to work (The exception I get is "NoPathCreated"). Any idea on how I could get this data would be appreciated!

This topic is closed to new replies. Start a new post to keep the conversation going.
m1b
m1bCorrect answer
Community Expert
April 20, 2023

Hi @Phil 815, I've written a script that includes a function getCellBounds. See this thread for the script. To get the bounds of a column (assuming that bounds of a cell wouldn't be adequate), you could calculate it similarly to the way getTableBounds function works. Let me know how you go.

- Mark

18 replies

Community Expert
June 9, 2023

@Marc Autret said: "[Of course there is no hope that Adobe cares about this bug and tries to fix it. They focus on serious things: renaming masterpage to parentpage, etc]"

 

Hi Marc,

just voted to fix the bug at InDesign UserVoice:

 

Moving Anchoring Text to Anchored Object Crashes InDesign
Marc Autret, June 08, 2023
https://indesign.uservoice.com/forums/913162-adobe-indesign-sdk-scripting-bugs-and-features/suggestions/46753123-moving-anchoring-text-to-anchored-object-crashes-i

 

Posted code there:

 

Code:
// Tested in ID CS6 and CC
// (see animation)
const BEG = LocationOptions.AT_BEGINNING;
var TFS = app.activeDocument.textFrames;

source = TFS.itemByName('source').texts[0]; // Text: contains the anchor

host = TFS.itemByName('host'); // TextFrame: 'host' frame
dest = host.textFrames.itemByName('dest'); // TextFrame: 'dest' frame

source.move(BEG,dest); // --> ID crash
//source.move(BEG,host); // WOULD BE OK
//source.duplicate(BEG,dest); // WOULD BE OK

 

 

Thanks Marc for reporting the bug.

 

PS: Attached the InDesign test document with the named text frames.

 

Regards,
Uwe Laubender
( Adobe Community Expert )

Translate
Robert at ID-Tasker
Legend
April 20, 2023

What exactly do you mean by "inline"?

 

Translate
Community Expert
April 20, 2023

Hi @Phil 815 ,

also look into the TableCellBox.jsx script by Marc Autret:

https://github.com/indiscripts/IdGoodies/blob/master/snip/TableCellBox.jsx

 

The Magic Parent Bounding Box
Marc Autret, August 04, 2022

https://www.indiscripts.com/post/2022/08/magic-parent-bounding-box

 

And a discussion in German that inspired Marc Autret at hilfdirselbst.ch:

https://www.hilfdirselbst.ch/foren/Koordinaten_einer_Tabellenzelle_P583998.html

 

Regards,
Uwe Laubender
( Adobe Community Expert )

Translate
Inspiring
June 6, 2023

The script is really amazing, but I managed to crash InDesign multiple times using it.

Im pretty sure the crash is caused by a table, that is inside an anchored text frame:

TextFrame → anchored TextFrame → Table     crashes every time
TextFrame → Table                          works reliably

 

Translate
Marc Autret
Legend
June 8, 2023

Update: The InDesign bug at the root of the issue is circumvented in TableCellBox.jsx v3 released today.

 

 

 

Best,

Marc

 

 

Translate
m1b
Community Expert
m1bCommunity ExpertCorrect answer
Community Expert
April 20, 2023

Hi @Phil 815, I've written a script that includes a function getCellBounds. See this thread for the script. To get the bounds of a column (assuming that bounds of a cell wouldn't be adequate), you could calculate it similarly to the way getTableBounds function works. Let me know how you go.

- Mark

Translate
Phil 815
Phil 815Author
Inspiring
April 25, 2023

These answers were extremely helpful and got me to a solution. Thank you!

Translate