DS Server

Javascript: ParagraphFormat.setAlignment Method

Method|Introduced in 26.0

Description

Sets the horizontal text alignment.

Syntax

<void> ParagraphFormat.setAlignment(<HorizontalAlignment> alignment, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
alignment

The horizontal text alignment.

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.setAlignment in a practical document-editing workflow. It sets the horizontal text alignment.

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

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