DS Server

Javascript: Selection.getFormattingStyle Method

Method|Introduced in 26.0

Description

Gets the formatting style of the selected text.

Syntax

<void> Selection.getFormattingStyle(<RequestStringCallback> callback, [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
callback

Receives the formatting style of the selected text or an empty string when the text selection contains multiple characters with different styles.

errorCallback

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

Examples

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

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

TXTextControl.selection.getFormattingStyle(
    function(result) {
        console.log("get formatting style result:", result);
    },
    onTxError
);