Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

How to: Add Dictionaries at Runtime

This code snippet will show you how to add two dictionaries of the OpenOffice type to be used by the XtraSpellChecker instance in your application. The first dictionary is for US English, the second - for French.

We do not produce or distribute dictionary files. They are readily available at the OpenOffice.org project page.

Warning

Note that the OpenOffice license cannot be used for commercial projects.

You should put these files somewhere on your machine, and adjust the paths accordingly.

using DevExpress.XtraSpellChecker;
using System.Globalization;
//...

SpellCheckerOpenOfficeDictionary dic_en_US = new SpellCheckerOpenOfficeDictionary();
dic_en_US.DictionaryPath = "en_US.dic";
dic_en_US.GrammarPath = "en_US.aff";
dic_en_US.Culture = new CultureInfo("en-US");
spellChecker1.Dictionaries.Add(dic_en_US);

SpellCheckerOpenOfficeDictionary dic_fr_FR = new SpellCheckerOpenOfficeDictionary();
dic_fr_FR.DictionaryPath = "fr_FR.dic";
dic_fr_FR.GrammarPath = "fr_FR.aff";
dic_fr_FR.Culture = new CultureInfo("fr-FR");
spellChecker1.Dictionaries.Add(dic_fr_FR);