devxlogo

Third-Party Spell Checker

Third-Party Spell Checker

Question:
I’m looking for a third-party library that does spell check and has some grammar rules.

Answer:
You have two solutions to this problem. One: you can purchase a third-party control and integrate it into your application. A good example that works with PowerBuilder is Visual Speller from Visual Components (a Sybase company).

A second solution if you have a word processor that support OLE automation installed in your user base is to use the built-in spelling checker for the application. Word is a good example, and the spell checker can easily be integrated into PowerBuilder. The following block of code is an example:

This is a function that accepts a string by reference and return an integer return code:

OleObject lole_SpellLong ll_RCSetPointer( HourGlass! )// Connect to word and do spell checklole_Spell = CREATE OleObjectll_RC = lole_Spell.ConnectToNewObject( 'Word.Application' )IF ll_RC  0 THEN	DESTROY lole_Spell	RETURN ll_RCEND IFlole_Spell.Application.Visible = Falselole_Spell.Application.WindowState = 2lole_Spell.Documents.Add()lole_Spell.Selection.TypeText( as_Text )lole_Spell.Selection.HomeKey()lole_Spell.Selection.MoveStart()lole_Spell.ActiveDocument.CheckSpelling()lole_Spell.ActiveDocument.Select()as_Text = lole_Spell.Selection.Textlole_Spell.ActiveDocument.Close( False )lole_Spell.Application.Quitlole_Spell.DisconnectObject()DESTROY lole_SpellRETURN 1

devx-admin

Share the Post: