Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Orthographic corrector : another question (VPos, can U help me ?)

Status
Not open for further replies.

clatimier

Programmer
Apr 11, 2003
26
FR
Hi

In another thread I ask how to implement an orthographic corrector. Vpos answered me very well and I thank him/here.
But I have another question, I try to trap the clic on the 'Cancel' button of the word corrector because it causes to loose the text I try to correct. Is it possible ? I find nothing to do this !

Thx
 
What CANCEL button? From what I can understand, VPOS's solution does a background checking in Word i.e. Word is not visible. If you want to provide a 'Cancel' or 'Undo' option, just store the text before you call Word and restore it. Also the CheckGrammer method returns a Boolean i.e. True (Grammar is correct) or False which you can trap. If you want to know more, why don't you check out the Visual Basic help in Word. Pressing Alt-F11 in Word takes you to the VB side and pressing F2 shows you all the methods and properties. Choose the property or method and press F1 to get the required help.
 
The Cancel button I talk about is the button on the checkGrammar box of Word which appears to correct some words.
Word is not visible but the box to correct is.
The main problem is that when u have several errors in the string, if u correct the first and after close the corrector, an empty string is return.
Using VB, i try to select the all string before to return it. I wrote the following :

ole = Create(0, Create:OLE)
ole{Prop:Create} = 'Word.Document.6'
ole{PROP:DoVerb} = -3
ole{'Application.Visible'} = True
ole{'Application.Documents.Add' }
ole{'Application.Selection.Text'} = chaineInitiale
ole{'Application.ActiveDocument.CheckGrammar' }
ole{'Application.Selection.EndKey'}
ole{'Application.Selection.HomeKey(Unit:=wdLine, Extend:=wdExtend) '}
chaineCorrigee = ole{'Application.Selection.Text'}

but when trying to execute :
ole{'Application.Selection.HomeKey(Unit:=wdLine, Extend:=wdExtend) '}
it seams that parameters (Unit:= and Extend:=) are not correctly send to word and the problem come from here.
 
Have you tried ole{'Application.Selection.HomeKey(5, 1) '}
since wdLine = 5 and wdExtend = 1?

The VB Syntax will not work in Clarion since it is treated as a normal procedure or function to which parameters are passed. If these parameters will return values then local variables need to be delcared and binded to be used.

 
Hi,

here is a solution.

WordID = CREATE(0,CREATE:Ole)
WordID{PROP:Create} = 'Word.Document'
WordID{PROP:DoVerb} = -3
WordID{'Application.Visible'} = False
WordID{'Application.Documents.Add' }
WordID{'Application.Selection.Text'} = MyText
WordID{'Application.ActiveDocument.CheckGrammar' }
! Trap cancel button
If WordID{'Application.Selection.Characters.Count'}>1 Then
MyText = WordID{'Application.Selection.Text'}
End
! Trap cancel button END
WordID{'Application.ActiveDocument.Close(0)'}
WordID{'Application.Close' }
WordID{PROP:DeActivate}
DESTROY(WordID)


Valery.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top