# Javascript: Table.selectCells Method

> Selects the part of the table defined through two table cells.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 28.0
- **Path:** DS Server > Reference > JavaScript API > Javascript: Table.selectCells Method
- **573 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/table/selectcells-method/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/table/selectcells-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/table/selectcells-method/llms-full.txt

---

### Description

Selects the part of the table defined through two table cells.

### Syntax

```javascript
<void> Table.selectCells(<number> startRow, <number> startColumn, <number> stopRow, <number> stopColumn, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| startRow | Specifies the row number where the selection begins. |
| startColumn | Specifies the column number where the selection begins. |
| stopRow | Specifies the row number where the selection ends. |
| stopColumn | Specifies the column number where the selection ends. |
| callback | Optional. Is called when the operation completed. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `Table.selectCells` in a practical document-editing workflow. It selects the part of the table defined through two table cells.

```javascript
function onTxError(error) {
    console.error("TX Text Control error:", error.msg);
    error.handled = true;
}

TXTextControl.textParts.getMainText(function(mainText) {
    const tables = mainText.tables;
    tables.getItem(function(table) {
        if (!table) {
            console.warn("No table is available at the current input position.");
            return;
        }
    
        table.selectCells(
            1,
            1,
            3,
            3,
            function() {
                console.log("select cells completed.");
            },
            onTxError
        );
    }, onTxError);
}, onTxError);
```

---

## Nearby

- **Previous:** [Javascript: Table.select Method](https://docs.textcontrol.com/ds-server/reference/javascript/table/select-method/llms-full.txt)
- **Next:** [Javascript: Table.setDescriptiveText Method](https://docs.textcontrol.com/ds-server/reference/javascript/table/setdescriptivetext-method/llms-full.txt)
