• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 502
  • Last Modified:

Adding spell check in DW

Hi All,
How can I add a spell check functionality in a datawindow .
I need to spell check on every text column of DW, I am using PB 10.50.

Thanks
Srikanth
0
shore-support
Asked:
shore-support
2 Solutions
 
diasroshanCommented:
Hi,

http://www.devx.com/tips/Tip/24943,

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

SetPointer( HourGlass! )

// Word is available so replace all CR/LFs with CRs
this.ReplaceChar( as_Text, '~r~n', '~r' )

// Connect to Word and do a spell-checklole_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

// Change the CRs back to CR/LFs
this.ReplaceChar( as_Text, '~r', '~r~n' )

as_Text will now contain text with the correct spelling.

Cheers,
Rosh
0
 
shore-supportAuthor Commented:
thanks Rosh ,

it is working

srikanth.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now