TX Text Control .NET Server

Javascript: MisspelledWordCollection.remove Method

Method|Introduced in 28.0

Description

Removes the specified misspelled word from a Text Control document. The method removes the word's reference in the list of misspelled words and replaces the word's text with the specified text.

Syntax

<void> MisspelledWordCollection.remove(<MisspelledWord> misspelledWord, <String> correctedText, <RequestBooleanCallback> callback, [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
misspelledWord

Specifies the misspelled word to remove.

correctedText

Specifies the corrected text. The current text of the word is replaced with this text.

callback

Receives whether the misspelled word could be removed.

errorCallback

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

Examples

The following example demonstrates MisspelledWordCollection.remove in a practical document-editing workflow. It removes the specified misspelled word from a Text Control document. The method removes the word's reference in the list of misspelled words and replaces the word's text with the specified text.

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

function remove(misspelledWords, misspelledWord) {
    misspelledWords.remove(
        misspelledWord,
        "Quarterly report",
        function(result) {
            if (result) {
                console.log("remove is available.");
            } else {
                console.warn("remove is not available in the current document state.");
            }
        },
        onTxError
    );
}