Skip to main content
jctremblay
Community Expert
Community Expert
March 12, 2017
Answered

How to select a row in a table from cursor position

Hi,

This is probably simple, but I can’t find how.

I need a snippet that will select and entire row from the location of the insertion of the cursor. Similar to the InDesign «Select Row» command.

Sorry for the newbie question.

This topic is closed to new replies. Start a new post to keep the conversation going.
Trevor:
Trevor:Correct answer
Legend
March 12, 2017

Hi Jean-Claude

function selectRow(s) {

    s = s || app.selection[0];

    if (!s) {

        return 'no selection';

    }

    while (s.constructor !== Cell){

        s = s.parent;

        if (s.constructor === Application) {

            return 'no cell found';

        }

    }

    s.parentRow.select();

}

selectRow();

HTH

Trevor

12 replies

Trevor:
Trevor:Correct answer
Legend
March 12, 2017

Hi Jean-Claude

function selectRow(s) {

    s = s || app.selection[0];

    if (!s) {

        return 'no selection';

    }

    while (s.constructor !== Cell){

        s = s.parent;

        if (s.constructor === Application) {

            return 'no cell found';

        }

    }

    s.parentRow.select();

}

selectRow();

HTH

Trevor

Translate
jctremblay
Community Expert
Community Expert
March 12, 2017

Thanks Trevor... That did it!

Translate