TX Text Control .NET Server

Javascript: FormattingStyleCollection.remove Method

Method|Introduced in 28.0

Description

Removes a formatting style from the collection.

Syntax

<void> FormattingStyleCollection.remove(<string> styleName, [<RequestBooleanCallback> callback], [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
styleName

The name of the style to remove.

callback

Optional. Receives true if the style could be removed, false if not.

errorCallback

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

Examples

The following example demonstrates FormattingStyleCollection.remove in a practical document-editing workflow. It removes a formatting style from the collection.

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

function remove(formattingStyles) {
    formattingStyles.remove(
        "Heading 1",
        function(result) {
            if (result) {
                console.log("remove is available.");
            } else {
                console.warn("remove is not available in the current document state.");
            }
        },
        onTxError
    );
}