When you think ASP, think...
Recent Articles xml
All Articles
ASP.NET Articles
Related Web Technologies
User Tips!
Coding Tips
spgif spgif

Sample Chapters
JavaScript Tutorials
MSDN Communities Hub
Official Docs
Stump the SQL Guru!
XML Info
Author an Article
spgif spgif
ASP ASP.NET ASP FAQs Feedback topnav-right
Print this page.
Published: Monday, April 24, 2000

Adding a Spell Checker to your Web Site

Due to the many questions on the ASP Messageboard on how to perform spell checking on a user's input, this article should prove useful. This article discusses how to use the XDE SpellChecked component, which serves as both a spell checker and a thesaurus. A nifty thing about this component is that it can be used server-side or as a Java applet. Unfortunately, such convenience does not come for free, and the component does cost money, $100 USD as of April 24th, 2000. However, there is a free, 30-day evaluation period, so you can tinker around with the component to see if it fits your needs before plunking down the $100.

- continued -

First things first, download and install the component! Start by visiting http://mirrordns.com/download/, where you will need to enter some information (name, title, email, etc.). Next you are taken to a listing of all the downloadable components from XDE. Choose to download the "Quick Spell Check Full Install." Once you download the install program, install it. You will be presented with a registration menu at the end of the install process - simply select "Evaluation Period," the default option.

Note that this is currently in BETA. If you don't like working with potentially buggy software, I recommend that you do not download this component until its first version is released. I have worked with the component and Java applet a bit and have found some bugs. Just so you know, this is BETA and not ready to be implemented in live systems.

At this point you are ready to register the component. You must decide now if you want to include Word 97's dictionary and thesaurus. This requires that Word 97 or Word 2000 be installed on the Web server! If you want to have this added functionality you will need to follow a special set of instructions, illustrated at http://mirrordns.com/spellchecker/server_installation.htm. If you are happy without using the entire Word 97 dictionary, go ahead and simply register the component like you would any other:

  • Copy the DLL (SpellCheckServer.dll) to your Window's System or System32 directory.
  • Register the component with regsvr32 (i.e.: regsvr32 spellcheckserver.dll)

Now that you have the component installed, you can use the server-side component in your ASP code! To create an instance of the SpellChecker object, simply use the following code:

Set objSpellCheck = Server.CreateObject("SpellCheck.ClsChecker")

As I mentioned earlier, this component provides both spell checking and thesaurus capabilities. First, let's examine how to return a list of synonyms for a given word. To do so, start by using the LookupSynonym method, which expects one parameter, the word to lookup synonyms for. Once this occurs, the SpellChecker object adds a collection of the related words to a collection named SynonymWords. The following snippet of code lists all the synonyms the SpellChecker object knows for the word "Quick."

  Dim objSpellChecker, iLoop
  'Create an instance of the SpellChecker
  Set objSpellCheck = Server.CreateObject("SpellCheck.ClsChecker")
  objSpellChecker.UseMSWord = False      'We're not using MSWord
  objSpellChecker.LookupSynonym "Quick"  'Lookup the synonym for "quick"

  'Loop through the returned words:
  Response.Write "The following synonyms for 'Quick' exist:<BR>"
  For iLoop = 1 To objSpellChecker.SynonymWords("Quick").SuggestedWords.Count
    Response.Write objSpellChecker.SynonymWords("Quick").SuggestedWords(iLoop).word
    Response.Write "<BR>"

A spell check can be performed on the server-side, which is neat, but the true power, in my opinion, lies with the Java applet spell checker. (This article will focus on using this Java applet to spell check. To learn more on how to spell check on the server side, check out: http://mirrordns.com/spellchecker/.)

To use the Java applet, you will need to move the .class files that are installed with the "Quick Spell Check Full Install" to a Web-accessible directory. For this example, I moved it to /spellcheck. Then, to use the applet, you will first need to create a form that will contain the text box or text area whose spelling you wish to check.

  <FORM NAME="frmSpellCheckExample">
    <textarea name="JavaTextArea" rows="8" cols="50"></textarea><P>
    <INPUT TYPE="button" value="Start Spell Check" onclick="SpellCheck();">

Next, instantiate the Java applet using the APPLET HTML tag:

<applet codebase ="/spellcheck/" code="SpellCheck.class"
        height="1" name="spellcheck" width="1"
        ALT="Applet not displayed">
  <param name="foreground" value="FFFFFF">
  <param name="background" value="008080">
  <param name="label" value="This string was passed from the HTML host.">

Note that the codebase parameter in the APPLET tag refers to the directory where the .class files were moved to!

Finally, a bit of client-side JavaScript code is used to populate the applet's parameters:

<script language="JavaScript">
function SpellCheck() {
  document.spellcheck.ptexttocheck =
  if (document.spellcheck.fixedtext!="") {
    document.frmSpellCheckExample.JavaTextArea.value =

There you have it! To learn more about this component and Java applet, be sure to check out http://mirrordns.com/spellchecker/.

Happy Programming!

Known Bugs for the SpellChecker Beta at the Time of Writing (4/24/00)
Here is a list of the known bugs for the beta version of the SpellChecker component.

  • The SpellChecker finds "I" to be misspelled
  • CRLF aren't handled well
  • The last word isn't always checked.
  • It's a tad slow
  • Sometimes the applet can't be used twice - haven't been able to recreate it but reloading the page fixes it.
  • Sometimes the button sticks for a moment causing the user to think it has locked up.

ASP.NET [1.x] [2.0] | ASPFAQs.com | Advertise | Feedback | Author an Article