Skip to main content

SelectRange

Selects a range of cells in the current table.

Syntax​

expression.SelectRange(startRowIndex, startCellIndex, endRowIndex, endCellIndex);

expression - A variable that represents an ApiTable class.

Parameters​

NameRequired/OptionalData typeDefaultDescription
startRowIndexRequirednumberThe start row index.
startCellIndexRequirednumberThe start cell index within the start row.
endRowIndexRequirednumberThe end row index.
endCellIndexRequirednumberThe end cell index within the end row.

Returns​

boolean

Example​

Select a rectangular range of cells in a table in a document.

// Highlight a block of cells spanning several rows and columns for further editing.

// Select the cells from the first cell of the first row to the second cell of the third row.

let doc = Api.GetDocument();
let table = Api.CreateTable(3, 3);
table.SetWidth("percent", 100);
doc.Push(table);
table.GetCell(0, 0).SetText("Start of the selected range.");
table.GetCell(2, 1).SetText("End of the selected range.");
table.SelectRange(0, 0, 2, 1);