# Javascript: ParagraphFormat.setTopDistance Method

> Sets distance, in twips, between this and the previous paragraph.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 26.0
- **Path:** TX Text Control .NET Server > Reference > JavaScript API > Javascript: ParagraphFormat.setTopDistance Method
- **345 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/paragraphformat/settopdistance-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/paragraphformat/settopdistance-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/paragraphformat/settopdistance-method/llms-full.txt

---

### Description

Sets distance, in twips, between this and the previous paragraph.

### Syntax

```javascript
<void> ParagraphFormat.setTopDistance(<number> distance, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| distance | The distance, in twips, between this and the previous paragraph. |
| callback | Optional. Is called when the operation completed. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `ParagraphFormat.setTopDistance` in a practical document-editing workflow. It sets distance, in twips, between this and the previous paragraph.

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

TXTextControl.paragraphFormat.setTopDistance(
    1440,
    function() {
        console.log("set top distance completed.");
    },
    onTxError
);
```

---

## Nearby

- **Previous:** [Javascript: ParagraphFormat.setTabTypes Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/paragraphformat/settabtypes-method/llms-full.txt)
- **Next:** [Javascript: ParagraphFormat.setWidowOrphanLines Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/paragraphformat/setwidoworphanlines-method/llms-full.txt)
