Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

What's the best solution for a free Spell Checker in my WinForms? I've seen the commercial ones but they cost around $300 for a single coder license. Requiring MS Office is perfectly fine as I'm coding an internal company app and every user will have Office 2003. (I'm coding in C# and will have no problem porting any VB solutions to C#)

 

The only free one I've come across is at http://www.devx.com/tips/Tip/13488 but I was wondering if there was a better/more efficient way. The solution at that URL is...

 

Integrate Microsoft Word 97's spellchecking capability into VB apps while maintaining formatting within a rich textbox. To test this code:

1. Create a standard EXE project in VB.

2. Add the RichTextBox control from the Components menu.

3. Add a reference to the Microsoft Word 8.0 Object Library.

4. Drop a RichTextBox and a CommandButton onto the form.

5. Rename the RichTextBox to rtfText.

6. Change the caption of the CommandButton to Spell Check.

7. In the Click event of the CommandButton, add the next code listing.

8. Save and run the project.

9. Type some text in the RTF box and click on the CommandButton to check the spelling.

 

On Error GoTo SpellCheckErr

Dim oWord As Object

 

Set oWord = CreateObject("Word.Application")

 

'Save the RTF Box contents to a temporary file

rtfText.SaveFile "C:\TEST.RTF", rtfRTF

 

'Open the saved document and spellcheck it

oWord.Documents.Open ("C:\TEST.RTF")

oWord.ActiveDocument.SpellingChecked = False

oWord.Options.IgnoreUppercase = False

oWord.ActiveDocument.CheckSpelling

 

'Save the changes to the RTF file & close

oWord.ActiveDocument.Save

oWord.ActiveDocument.Close

oWord.Quit

 

'Load the changes back to the rtf text box.

rtfText.LoadFile "C:\TEST.RTF", rtfRTF

 

Set oWord = Nothing

Screen.MousePointer = vbDefault

MsgBox "Spell Check is complete", _

vbInformation, "Spell Check"

Exit Sub

 

SpellCheckErr:

MsgBox Err.Description, vbCritical, _

"Spell Check"

Set oWord = Nothing

 

// Rohit Kapoor

Experience is something you don't get until just after the moment you needed it
  • Moderators
Posted
We've discussed this many times here (The answer is use the Word object or buy a third party control) ....http://www.xtremedotnettalk.com/showthread.php?threadid=76257&highlight=spell+check
Visit...Bassic Software
Posted

Ahh, I should have searched the forum first, my bad.

 

After reading that thread and a little more research I uncovered this spell checker that supports a massive (220,000+ words) 4meg dictionary file and realtime spell checking in controls.

 

The quick shortcut to it is http://www.codeproject.com/cpp/spellchecker_mg.asp

Experience is something you don't get until just after the moment you needed it
  • 2 weeks later...
Posted
Even better, download the VB Resource kit from Microsoft and register it (free). You get a fully functioning (and distributable) version of a spell checking library.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...