# Javascript: FrameBase.setAlignment Method

> Sets the frame's horizontal alignment when it is anchored to a paragraph.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 28.0
- **Path:** DS Server > Reference > JavaScript API > Javascript: FrameBase.setAlignment Method
- **367 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/framebase/setalignment-method/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/framebase/setalignment-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/framebase/setalignment-method/llms-full.txt

---

### Description

Sets the frame's horizontal alignment when it is anchored to a paragraph.

### Syntax

```javascript
<void> FrameBase.setAlignment(<HorizontalAlignment> value, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| value | The new property value. |
| callback | Optional. Is called when the operation completed. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `FrameBase.setAlignment` in a practical document-editing workflow. It sets the frame's horizontal alignment when it is anchored to a paragraph.

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

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

---

## Nearby

- **Previous:** [Javascript: FrameBase.getTextPosition Method](https://docs.textcontrol.com/ds-server/reference/javascript/framebase/gettextposition-method/llms-full.txt)
- **Next:** [Javascript: FrameBase.setDescriptiveText Method](https://docs.textcontrol.com/ds-server/reference/javascript/framebase/setdescriptivetext-method/llms-full.txt)
