Spell Checking in Rich Text Editor
- 3 minutes to read
The RichEditControl uses the Spell Checker component to implement the spell checking functionality.
Follow the steps below to add a spell checker to your application.
#Add the SpellChecker component
The SpellChecker is added automatically when the RichEditControl application is created using the Template Kit for WinForms or Template Gallery. Drag the SpellChecker component icon from Visual Studio’s toolbox onto the form to add the SpellChecker to the application manually. The RichEditControl.SpellChecker property is set once the component is placed onto the form.
Note
When the Rich
#Add Dictionaries
Add one of the following dictionaries:
- SpellCheckerDictionary;
- SpellCheckerISpellDictionary;
- SpellCheckerOpenOfficeDictionary;
- HunspellDictionary;
- SpellCheckerCustomDictionary.
#Dictionary Culture
The SpellCheckerOptions.AutoDetectDocumentCulture property determines whether the SpellChecker automatically detects current text’s culture (returned by the CharacterPropertiesBase.Language property) and selects the corresponding dictionary. If the AutoDetectDocumentCulture property is false and the SpellCheckerBase.Culture is set to “En-US”, the SpellChecker uses the English dictionary to check spelling.
When you add dictionaries and set the AutoDetectDocumentCulture property to false, the SpellChecker uses dictionaries that correspond with the SpellCheckerBase.Culture property. Set the Culture property to Invariant to use all dictionaries.
#Specify the SpellChecker options
Fine-tune the spell checker. Use one of the following properties to specify the spell checker’s options:
API | Description |
---|---|
Spell |
Provides access to the Options |
Rich |
Obtains a Spell |
Spell |
Gets or sets the Xtra |
Spell |
Gets or sets the type of form that is shown when a possible misspelled word is found. |
Note
Spell
#Result
End users can use the Spelling item on the Review ribbon tab to check the document’s spelling. The invoked Spelling Dialog allows you to select the misspelled word’s replacement, skip it or add it to the dictionary.
The SpellCheckMode.AsYouType mode underlines misspelled words. End users can right-click these words and replace them with a suggestion from the context menu or invoke the Spelling Dialog by clicking the Spelling item.
Note
The Spell