TX Text Control .NET Server

Javascript: Selection.setFormattingStyle Method

Method|Introduced in 26.0

Description

Sets the formatting style of the selected text.

Syntax

<void> Selection.setFormattingStyle(<string> formattingStyle, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
formattingStyle

The formatting style of the selected text.

callback

Optional. Is called when the operation completed.

errorCallback

Optional. Is called when the operation failed with an error.

Examples

The following example demonstrates Selection.setFormattingStyle in a practical document-editing workflow. It sets the formatting style of the selected text.

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

TXTextControl.selection.setFormattingStyle(
    "MM/dd/yyyy",
    function() {
        console.log("set formatting style completed.");
    },
    onTxError
);