Login
`
Templates, Tools and Utilities
|
||
Icetips Article
Back to article list
Search Articles
Add Comment
Printer friendly
Direct link
OLE/ActiveX: Use Word for spellchecking 2005-10-12 -- Peter Halbert Newsgroups: softvelocity.clarion.third_party
>How can I use Word to spell check memo fields?
Paste the the pocedure below and call it like this:
MyTable:MyField=ENTMSWordSpell(MyTable:MyField)
or
?MyControl{PROP:Text}=ENTMSWordSpell(?MyControl{PROP:Text})
it's designed to return the original passed text if no changes or cancel is
selected. That way you don;t have to worry about checking for cancel etc...
I've been using this for a bout 2 years, it works great. I use it with
entries, text, rftcontrol, FileExploreHTMLControl - onlt trouble with HTML
is the tags
ENTMSWordSpell PROCEDURE (STRING pText) ! Declare
Procedure
WordID Signed
Code
pText = ENTFindReplace(pText, '<13,10>', '<13>')
! Replace CR/LF with just CR
WordID = CREATE(0,CREATE:Ole)
WordID{PROP:Create} = 'Word.Document'
WordID{PROP:DoVerb} = -3
WordID{'Application.Visible'} = False
!Word has tendancy to popup, this helps to keep it down
WordID{'Application.Documents.Add' }
WordID{'Application.Selection.Text'} = pText
WordID{'Application.Visible'} = False
WordID{'Application.ActiveDocument.CheckGrammar' }
WordID{'Application.Visible'} = False
! Trap cancel (This code sucks and needs to be redone -
! works in mostsituations, but has issues)
If WordID{'Application.Selection.Characters.Count'} > 1
pText = WordID{'Application.Selection.Text'}
WordID{'Application.Visible'} = False
End
! Trap cancel END
WordID{'Application.ActiveDocument.Close(0)'}
WordID{'Application.Visible'} = False
WordID{'Application.Close' }
WordID{'Application.Visible'} = False
WordID{PROP:DeActivate}
Destroy(WordID)
pText = ENTFindReplace(pText & ALL(' ', 2000), '<13>', '<13,10>')
! Set them back - replace CR with CR/LF combination (the extra 2K
! are for linefeed characters, just in case)
Return CLIP(pText)
Today is November 23, 2024, 11:12 pm This article has been viewed 35399 times. Google search has resulted in 12 hits on this article since January 25, 2004.
|
|