Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: COM/DCOM/COM+
Expertise: Beginner
Dec 7, 1998

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_Spell
Long ll_RC

SetPointer( HourGlass! )

// Connect to word and do spell check
lole_Spell = CREATE OleObject
ll_RC = lole_Spell.ConnectToNewObject( 'Word.Application' )
IF ll_RC <> 0 THEN
	DESTROY lole_Spell
	RETURN ll_RC
END IF

lole_Spell.Application.Visible = False
lole_Spell.Application.WindowState = 2
lole_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.Text
lole_Spell.ActiveDocument.Close( False )
lole_Spell.Application.Quit
lole_Spell.DisconnectObject()
DESTROY lole_Spell

RETURN 1
DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date