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

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.

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);