Using MS Word to Spell-Check in PowerBuilder

Using MS Word to Spell-Check in PowerBuilder

I need to incorporate Microsoft Word 97 spell-check functionality into PowerBuilder. Which MS Word functions are required to do the task?

To interface to the Word spelling checker you will need to use OLE Automation to create a link to the Word application, then call the correct Word Basic functions.

The following code opens up the spelling checker dialog box for you. Note that you will need to convert any CR/LFs in PowerBuilder to CRs before calling the Word dialog box and then change the CRs back to CR/LFs after calling the module.

 OleObject lole_SpellLong ll_RCSetPointer( HourGlass! )// Word is available so replace all CR/LFs with CRsthis.ReplaceChar( as_Text, '~r~n', '~r' )// Connect to Word and do a 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_Spell// Change the CRs back to CR/LFsthis.ReplaceChar( as_Text, '~r', '~r~n' )

as_Text will now contain text with the correct spelling.

Share the Post:
data observability

Data Observability Explained

Data is the lifeblood of any successful business, as it is the driving force behind critical decision-making, insight generation, and strategic development. However, due to its intricate nature, ensuring the

Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular