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 WPF 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, for example when a space or a period follows it. This is the intended behavior, not an error: type a delimiter or click elsewhere, and the word is underlined. How As-You-Type Checking Works describes when words are checked.
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: IgnoreWord and IgnoreCase leave out words in capitals, words with numbers, e-mail addresses and URLs, and find a capitalized word under its lowercase form. 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, and to check capitalization strictly,IgnoreCasetoTXSpell.IgnoreCaseSettings.Never. Ignore Settings lists every value, and users change them on the Spell Checking Options tab of the Options Dialog. - Look for the word in the user dictionaries of the application, and remove it there if it doesn't belong; see User Dictionaries.
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, use at most one of Always, Never, WordBegin and WordBeginUpper, and in IgnoreWord, use Never alone. Choose How Case Is Handled and Choose Which Words Are Not Checked give the rules.
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 window 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 index. Pass an array with at least one index, such as new int[] { 0 }, or call OptionsDialog() without activeTabs to show all tabs. Show Only Some Tabs lists the indices.
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.
- Get the spell checker from the resources of the window with
FindResource, and call itsCreate()method once, in the constructor of the window afterInitializeComponent, when noTextControlis connected to it. - 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 window.
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. Spell checking is off in the editor by default, and getIsSpellCheckingEnabled returns true after it is switched on, even when no spell checker is present.
- Install
TXTextControl.TXSpell.Core.SDKin the project that hosts the Document Editor backend, and rebuild it. - Switch spell checking on with setIsSpellCheckingEnabled, or with Enable Spell Checking on the Proofing tab.
- For text in another language than US English, add its dictionary to the Dictionaries folder of the project.
TX Text Control .NET Server Document Editor describes the setup.