# Javascript: TableCell.getLength Method

> Gets the number of characters in the table cell. If the table cell is merged, the property returns -1.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 28.0
- **Path:** DS Server > Reference > JavaScript API > Javascript: TableCell.getLength Method
- **340 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/tablecell/getlength-method/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/tablecell/getlength-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/tablecell/getlength-method/llms-full.txt

---

### Description

Gets the number of characters in the table cell. If the table cell is merged, the property returns -1.

### Syntax

```javascript
<void> TableCell.getLength(<RequestNumberCallback> callback, [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| callback | Receives the number of characters in the cell. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `TableCell.getLength` in a practical document-editing workflow. It gets the number of characters in the table cell. If the table cell is merged, the property returns -1.

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

function inspectLength(tableCell) {
    tableCell.getLength(
        function(result) {
            console.log("get length result:", result);
        },
        onTxError
    );
}
```

---

## Nearby

- **Previous:** [Javascript: TableCell.getFormula Method](https://docs.textcontrol.com/ds-server/reference/javascript/tablecell/getformula-method/llms-full.txt)
- **Next:** [Javascript: TableCell.getName Method](https://docs.textcontrol.com/ds-server/reference/javascript/tablecell/getname-method/llms-full.txt)
