# Javascript: ParagraphFormat.getAlignment Method

> Gets the horizontal text alignment.

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

---

### Description

Gets the horizontal text alignment.

### Syntax

```javascript
<void> ParagraphFormat.getAlignment(<RequestHorizontalAlignmentCallback> callback, [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| callback | Receives the horizontal text alignment. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `ParagraphFormat.getAlignment` in a practical document-editing workflow. It gets the horizontal text alignment.

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

TXTextControl.paragraphFormat.getAlignment(
    function(alignment) {
        if (!alignment) {
            console.warn("No horizontal alignment was returned.");
            return;
        }
        
        console.log("get alignment result:", alignment);
    },
    onTxError
);
```

---

## Nearby

- **Previous:** [Javascript: ParagraphFormat.getAbsoluteLineSpacing Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/paragraphformat/getabsolutelinespacing-method/llms-full.txt)
- **Next:** [Javascript: ParagraphFormat.getBackColor Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/paragraphformat/getbackcolor-method/llms-full.txt)
