# Javascript: Paragraph.getText Method

> Gets the paragraph's text.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 28.0
- **Path:** TX Text Control .NET Server > Reference > JavaScript API > Javascript: Paragraph.getText Method
- **409 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/paragraph/gettext-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/paragraph/gettext-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/paragraph/gettext-method/llms-full.txt

---

### Description

Gets the paragraph's text.

### Syntax

```javascript
<void> Paragraph.getText(<RequestStringCallback> callback, [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| callback | Receives the paragraph's text. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `Paragraph.getText` in a practical document-editing workflow. It gets the paragraph's text.

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

TXTextControl.textParts.getMainText(function(mainText) {
    const paragraphs = mainText.paragraphs;
    paragraphs.getItem(function(paragraph) {
        if (!paragraph) {
            console.warn("No paragraph is available at the current input position.");
            return;
        }
    
        paragraph.getText(
            function(result) {
                console.log("get text result:", result);
            },
            onTxError
        );
    }, onTxError);
}, onTxError);
```

---

## Nearby

- **Previous:** [Javascript: Paragraph.getStartLine Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/paragraph/getstartline-method/llms-full.txt)
- **Next:** [Javascript: Paragraph.listFormat Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/paragraph/listformat-property/llms-full.txt)
