Skip to main content
Known Participant
January 5, 2009
Question

[JS CS3] Moving the insertion point to the next table cell

  • January 5, 2009
  • 2 replies
  • 1975 views
I can't quite get my head around this one...

Assuming that all the text in a table cell is selected, I want to move the selection to the next cell below the current cell, and select the text in that cell. I need to script this simple maneuver so I can assign a keyboard shortcut to it.

In other words, the script should programmatically do the same thing as [down arrow][esc][esc] does in a table.

I've been trying InsertionPoint.move, but can't quite figure out how to do this within a table framework.

Any ideas/pointers would be appreciated. Thanks.
This topic has been closed for replies.

2 replies

Known Participant
January 5, 2009
Thanks Peter. This is exactly what I needed to get going!
Peter Kahrel
Community Expert
Community Expert
January 5, 2009
if (app.selection[0].parent instanceof Cell)

{
row = app.selection[0].parent.parentRow.index;
app.selection[0].parent.parentColumn.cells[row+1].texts[0].select();
}


The script should really also check whether you're you're in the last row of the table.

Peter
Known Participant
April 10, 2013

Something's going wrong when I apply it here to my table. It works fine on the first column, but otherwise it just keeps on skipping rows seemingly randomly.

Jongware
Community Expert
Community Expert
April 10, 2013

LGFN1, do you have vertically split/merged cells in your table?