DS Server

MisspelledWordCollection Object

Object|Introduced in 28.0

Description

The MisspelledWordCollection contains all misspelled words in the main part of a Text Control document.

Syntax

MisspelledWordCollection

Examples

The following example demonstrates MisspelledWordCollection in a practical document-editing workflow. The MisspelledWordCollection contains all misspelled words in the main part of a Text Control document.

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

function inspectMisspelledWordCollection(misspelledWords) {
    misspelledWords.getCountOf(
        TXTextControl.MisspelledWordKind.All,
        function(result) {
            console.log("get count of result:", result);
        },
        onTxError
    );
}

Members

Methods

MethodDescription
elementAtReturns the element at a specified index in the collection. (Inherited from Collection.)
forEachExecutes a callback function for each element. (Inherited from Collection.)
getCountGets the number of elements contained in the collection. (Inherited from Collection.)
getCountOfGets the number of misspelled words with a special meaning from the collection.
getItemAtInputPositionGets the misspelled word of the specified kind at the current text input position. If there is no misspelled word, the next possible word of is returned. If there is no misspelled word of the specified kind between the current input position and the end of the text, the first word of the specified kind is returned.
getItemAtLocationGets the misspelled word at a certain geometrical location. If there is no misspelled word, null is returned.
getItemAtTextPositionGets the misspelled word of the specified kind at the specified text input position. If there is no misspelled word, the next possible word is returned. If there is no misspelled word of the specified kind between the specified input position and the end of the text, the first word of the specified kind is returned.
ignoreChanges the text of the specified misspelled word and marks it as ignored. Ignored misspelled words are not underlined with a red zigzag line.
removeRemoves 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.