TX Text Control .NET Server

Javascript: Selection.setCharacterSpacing Method

Method|Introduced in 30.0

Description

Sets the style's character spacing value, in twips. This value is added to each character. When it is negative, character spacing is reduced, otherwise it is extended.

Syntax

<void> Selection.setCharacterSpacing(<number> characterSpacing, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
characterSpacing

The new 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 Selection.setCharacterSpacing in a practical document-editing workflow. It sets the style's character spacing value, in twips. This value is added to each character. When it is negative, character spacing is reduced, otherwise it is extended.

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

TXTextControl.selection.setCharacterSpacing(
    1,
    function() {
        console.log("set character spacing completed.");
    },
    onTxError
);