Skip to main content
A newer version of this page is available. .

Spell Checking

  • 3 minutes to read

The RichEditControl uses the Spell Checker component to implement the spell checking functionality.

Perform the following steps to add a spell checker to your application:

  1. The SpellChecker is added automatically when the RichEditControl application is created using the Template Gallery. To add the SpellChecker to the application manually, drag the SpellChecker component icon from Visual Studio’s toolbox onto the form that contains the RichEditControl. The RichEditControl.SpellChecker property is set once the component is placed onto the form.

    XtraRichEdit_SpellChecker_AddFromToolbox

    Note

    When the RichEditControl is used as a repository editor in XtraGrid, spelling suggestions could be missing from the context menu if the RichEditorControl is not on the same form as the SpellChecker. To avoid this, force menu creation by calling the SpellChecker.SetShowSpellCheckMenu method within the ColumnView.ShownEditor event.

  2. Add one of the following supported dictionaries:

    The SpellChecker uses the default English dictionary if no dictionary is specified. The default dictionary is not loaded when any other dictionary, including a custom dictionary, is added. Refer to the Dictionaries topic for details.

    The SpellChecker automatically detects current text’s culture (returned by the CharacterPropertiesBase.Language property) and selects the corresponding dictionary. If the document should only use one dictionary if it contains text with different cultures, set the dictionary’s Culture property to Invariant or set the SpellCheckerOptions.AutoDetectDocumentCulture property to false.

  3. Fine-tune the spell checker. Use one of the following properties to specify the spell checker’s options:

    API Description
    SpellChecker.OptionsSpelling Provides access to the OptionsSpelling instance that contains options that affect text processing.
    RichEditControlOptionsBase.SpellChecker Obtains a SpellCheckerOptions object containing options that specify how the spell checker should process text in any document range.
    SpellChecker.SpellCheckMode Gets or sets the XtraSpellChecker’s operation mode.
    SpellCheckerBase.SpellingFormType Gets or sets the type of form that is shown when a possible misspelled word is found.

    Note

    The options the SpellChecker.CheckAsYouTypeOptions property specifies does not affect the RichEditControl.

As a result, end-users can use the Spelling item on the Review ribbon tab to check the document’s spelling. It invokes the Spelling Dialog allowing you to select the misspelled word’s replacement, skip it or add it to the dictionary.

Enabling 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.

RichEdit_SpellChecker

Note

The SpellChecker does not support underlining misspelled words in multiple controls at the same time. Words are underlined in the currently focused control only. Use the SpellChecker.CheckContainer method to check spelling in multiple controls at once on demand.

See Also