If you are looking for a free Delphi spell checking component for use in your windows applications, you cannot do much better that HunSpell. http://hunspell.sourceforge.net/
HunSpell is a free spell checker that is used by many high profile open source projects, such as OpenOffice.
It is distributed in the form of a Windows DLL that you can ship alongside your application, and also has a great number of dictionaries for various languages. http://wiki.services.openoffice.org/wiki/Dictionaries
Where To Start?
Many users downloading the Delphi code from the HunSpell page above will encounter a few problems. Firstly the code does not work with multibyte strings (Delphi 2009+), and the source code samples given depend on a Delphi project that is no longer supported to get working. There are also a couple of bugs in the code provided.
The zip file downloadable below contains all that is needed to implement spell checking in your Delphi applications.
Getting HunSpell Working:
The code in the zip file provided contains the British English dictionaries (if you need other dictionaries, check the links above), the HunSpell DLL, and a fully working non-visual component that can be installed on your component pallet, and included in your applications.
You should install the TSpellCheck component, this component has three properties:
AffFileName: The .aff file with the dictionary you wish to use.
DictFileName: The .dic file with the dictionary you wish to use.
Active: This must be set to True for the component to connect to the HunSpell DLL, and load the dictionary specified.
Creating The Spell Check Component In Code:
If the control is not setup at design time, you can setup the component in code as follows:
procedure TForm1.FormCreate(Sender: TObject);
SpellCheck1 := TSpellCheck.Create(Self);
SpellCheck1.AffFileName := ExtractFilePath(Application.ExeName)+'dict\en_GB.aff';
SpellCheck1.DictFileName := ExtractFilePath(Application.ExeName)+'dict\en_GB.dic';
SpellCheck1.Active := True;
Spell Checking & Suggestions:
You now have a component setup that will allow you to spell check words, and request suggestions as below:
procedure TForm1.Button1Click(Sender: TObject);
if SpellCheck1.IsMisspelled(Edit1.Text) then
ShowMessage(Edit1.Text+' is not misspelled');
The zip file below also includes a demo project to get you started, play around with it a bit…
If you want to add live spelling, also checkout the Live Spell TEdit control that can be used with this component.
Download Free Delphi Spell Checker: