# Javascript: TXTextControl.HorizontalAlignment Enumeration

> Specifies the horizontal alignment of a text.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Enumeration
- **Path:** DS Server > Reference > JavaScript API > Javascript: TXTextControl.HorizontalAlignment Enumeration
- **311 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/horizontalalignment-enumeration/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/horizontalalignment-enumeration/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/horizontalalignment-enumeration/llms-full.txt

---

### Description

Specifies the horizontal alignment of a text.

### Members

| Member | Description |
|---|---|
| Left | Text is aligned at the left. |
| Right | Text is aligned at the right. |
| Center | Text is aligned at the center. |
| Justify | Text is justified. |

### Examples

The following example uses `TXTextControl.HorizontalAlignment.Center` (text is aligned at the center.) in a document-editing workflow.

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

function applyHorizontalAlignment(frameBase) {
    frameBase.setAlignment(
        TXTextControl.HorizontalAlignment.Center,
        function() {
            console.log("set alignment completed.");
        },
        onTxError
    );
}
```

---

## Nearby

- **Previous:** [Javascript: TXTextControl.HighlightMode Enumeration](https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/highlightmode-enumeration/llms-full.txt)
- **Next:** [Javascript: TXTextControl.HtmlDialogBoxKind Enumeration](https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/htmldialogboxkind-enumeration/llms-full.txt)
