Using NHunspell Dictionary

The editor embeds NHunspell Spell Checker Engine and therefore you can use any Open Office dictionary. In order to use NHunspell Spell Checker Engine, you need to follow the following steps.

1. Set the SpellCheckerOption.SpellChecker = NHunspell as shown in the following Screenshot.

Setting_ NHunspell_ Engine

2. Import the 2 NHunspell DLL files that you found in the Download Package, in a folder named "NHunspell DLL".

NHunspell_dll_dir

3. Import these 2 DLL files to your Project and set "Copy to Output Directory" property value for these files = Copy Always.

copy_always

Thats all you need to do in order to use NHunspell Spell Checker Engine when you want to use US English Dictionary. Because, US English Dictionary is already embedded to the editor and if you do not specify any dictionary file path, the US English Dictionary is used from its embedded resource.

If you want to use a dictionary file other than US English Language, then, you need to set Dictionary File Path and Affix File Path as shown in the following Screenshot.

Setting_dic_files_ Nhunspell

But it is not practical to set the Dictionary files from Design Time unless you want to test quickly. Because, the design time setting will always Absolute Path and you wont use absoute path for your distributable application. Rather you should import the dictionary files (along with affix files) to your project and set the Dictionary and Affix file path Run time to resolve the path dynamically. Say, you have added the fr-FR.aff and fr-FR.dic file to your project and set "Copy to Output Directory" property value for these files = Copy Always so that these files are copied to the bin folder. After that, the typical snippet to set the dictionary files can be as follows:

        private void Form1_Load(object sender, System.EventArgs e)
        {
            winFormHtmlEditor1.SpellCheckOptions.DictionaryFile.DictionaryFilePath = 
                Application.StartupPath + "\\fr_FR.dic";
          
            winFormHtmlEditor1.SpellCheckOptions.DictionaryFile.AffixFilePath =
                Application.StartupPath + "\\fr_FR.aff";
        }

Where to find the Dictionary Files ?

Ok, once you started liking the NHunspell Spell checker, you would be asking, where can I get the *.dic and *.aff files for other languages.

You can use any Open Office Dictionary files as NHunspell supports Open Office Dictionaries. You can visit http://extensions.openoffice.org, browse the Dictionaries menu and you will find various language dictionaries. Click the link for your preferred dictionary and Download the Dictionary package which is usually a file with extension *.oxt.

downloading_open_office_dic 1

downloading_open_office_dic 2

Once you downloaded the *.oxt file, rename the file to a *.zip file and unzip.

oxt_to_zip_renaming

Once you unzip the file, you will find a folder with the name of Language code. For the above example, the folder name would be de_DE_frami. Open that folder and you will find the *.aff and *.dic file.

opening_language_folder

Once you found the *.aff and *.dic file, you can import these files to your project and set the Affix File and Dictionary File path accordingly.

HNunspell DLL folder path

The editor has setting SpellCheckOptions.NHunspellDllFolderPath. It allows you to override the path where the editor loads NHunspell DLLs from. By default, this setting is not set and the editor loads the DLLs from the application directory.

NHunspell DLL folder path

Last updated on Mar 31, 2016