Spell Checking
The spell checker is connected and its dictionaries are found, yet a misspelled word stays unmarked, or a call of TX Spell .NET for Windows Forms throws an exception. Such problems come from the rules of the spell checker rather than from its installation: which words it checks, when TX Text Control asks it, and which calls it refuses while a dialog is open. When no word is marked at all, start with Spell Checking Doesn't Start and Dictionaries Not Found.
A Word Isn't Underlined While You Type It
In a TextControl, the word you are typing isn't underlined, although it is misspelled. It is underlined only after you type a space.
Since version 29.0 (X19) of TX Text Control, a word is checked once it is complete: when a delimiter such as a space or a period follows it, when the input position moves elsewhere, or when the document loses the focus. Earlier versions marked a word while it was still being typed. This is the intended behavior, not an error.
- Type a space or a period after the word, or click elsewhere in the document.
- Check that the word is underlined now.
As-You-Type Checking shows both behaviors side by side.
Some Misspelled Words Aren't Marked
Most misspelled words are marked, but some are not: words in capitals such as "NASA", words with digits such as "R2D2", e-mail addresses or URLs.
The spell checker skips these words by default, as What the Spell Checker Skips by Default describes. The defaults of IgnoreWord and IgnoreCase can also be changed by users, on the Spell Checking Options tab of the options dialog.
A word is also not marked when the user chose Ignore All for it, or added it to a user dictionary with Add To Dictionary.
To check every word, set
IgnoreWordtoTXSpell.IgnoreWordSettings.Never:txSpellChecker1.IgnoreWord = TXTextControl.Proofing.TXSpell.IgnoreWordSettings.Never;To check capitalization strictly, set
IgnoreCasetoTXSpell.IgnoreCaseSettings.Never.Look for the word in the user dictionaries of the application, and remove it there if it doesn't belong.
Ignore Settings lists every value, and User Dictionaries describes the words users add.
Setting IgnoreCase or IgnoreWord Throws an Exception
Assigning a combination of values to IgnoreCase or IgnoreWord throws an exception.
Not every combination of the flags is valid: in IgnoreCase, Always, Never, WordBegin and WordBeginUpper exclude one another, and in IgnoreWord, Never can't be combined with any other value.
- Use at most one of
Always,Never,WordBeginandWordBeginUpperinIgnoreCase. - Use
Neveralone inIgnoreWord, or leave it out.
Ignore Settings lists every value and what it can be combined with.
A Call Throws While the Spell Check Dialog Is Open
A method of the spell checker throws an exception when your code calls it, for example from an event handler or a button that the user clicks while the spell check dialog is shown.
Some methods refuse to run while the SpellCheckDialog is open:
| Method | Throws while the dialog is open |
|---|---|
| TXSpellChecker.Check | Always |
| DictionaryCollection.Add and Remove | Except for a UserDictionary added or removed in the options dialog that a button of the spell check dialog opened |
| DialogButtonCollection.Add, AddRange and Remove | Always |
- Load dictionaries and add or remove dialog buttons before the dialog is shown, for example when the form loads.
- Call
Checkbefore you open the dialog or after it is closed.
Loading and Managing Dictionaries and Customizing the Spell Check Dialog show where these calls belong.
OptionsDialog Throws an ArgumentException
Opening the options dialog with the list of tabs to show throws an ArgumentException.
The overloads of OptionsDialog that take activeTabs need at least one tab. The indices are zero-based: 0 is the spell checking options, 1 the dictionaries, 2 the hyphenation options and 3 the thesaurus files.
- Pass an array with at least one index, such as
new int[] { 0 }. - To show all tabs, call
OptionsDialog()withoutactiveTabs.
Options Dialog describes the tabs.
The SpellCheckText Event Isn't Raised
A handler of the SpellCheckText event of the TextControl is never called.
SpellCheckText is raised only when the SpellChecker property of the TextControl is null and IsSpellCheckingEnabled is true. When TX Spell .NET is connected, TX Text Control handles the event internally.
- To react to the words TX Spell .NET finds, use the events of the spell checker instead; see Events.
- To use a spell checker of your own, set
SpellCheckertonulland handleSpellCheckText.
TX Text Control .NET for Windows Forms describes the event.
The Spell Checker Isn't Initialized Without TX Text Control
A TXSpellChecker that checks a RichTextBox, a TextBox or text in code doesn't work as the samples show, while the same spell checker works with a TextControl.
Create initializes the resources of the spell checker and must be called before it is used. A connected TextControl calls it for you, and then it must not be called again. Without a TextControl, nothing calls it. The same applies to a TXSpell object, whose Create comes first as well.
- Call
txSpellChecker1.Create()once, in the constructor of the form afterInitializeComponent, when noTextControlis connected to the spell checker. - Don't call it for a spell checker that the
SpellCheckerproperty of aTextControlrefers to.
Check Spelling as You Type shows the call in a complete form.
The Document Editor Doesn't Mark Misspelled Words
In the Document Editor of TX Text Control .NET Server, no word is underlined, although the text contains misspelled words.
The editor checks spelling with TXTextControl.TXSpell.Core.SDK, which must be installed in the ASP.NET Core application that hosts the backend, and spell checking is off in the editor by default. getIsSpellCheckingEnabled returns true after it is switched on, even when no spell checker is present, so it doesn't tell you whether the package is found.
- Install
TXTextControl.TXSpell.Core.SDKin the project that hosts the Document Editor backend, and rebuild it. - Switch spell checking on, as Turn On Spell Checking shows.
Check That TX Spell .NET Is Found describes the symptoms of a missing package.