Here is some code that demonstrates how to tap into teh Word SpellChecker...
PUBLIC oform1
oform1=NEWOBJECT("form1")
oform1.Show
RETURN
**************************************************
*-- Form: form1 (d:\documents\devcon 98\com-05\samples\spellcheck.scx)
*-- ParentClass: form
*-- BaseClass: form
*-- Time Stamp: 05/16/98 08:16:04 AM
*
DEFINE CLASS form1 AS form
Top = 10
Left = 9
Height = 370
Width = 429
DoCreate = .T.
Caption = "Spell and Grammar Checking with Microsoft Word 97"
Name = "Form1"
oword = .F.
ADD OBJECT edttext AS editbox WITH ;
Height = 145, ;
Left = 2, ;
Top = 6, ;
Width = 420, ;
Name = "edtText"
ADD OBJECT command1 AS commandbutton WITH ;
Top = 288, ;
Left = 24, ;
Height = 25, ;
Width = 121, ;
Caption = "Check Spelling", ;
Name = "Command1"
ADD OBJECT chkgrammar AS checkbox WITH ;
Top = 288, ;
Left = 168, ;
Height = 17, ;
Width = 192, ;
Caption = "Check Grammar with Spelling?", ;
Value = .F., ;
Name = "chkGrammar"
ADD OBJECT lstdictionaries AS listbox WITH ;
Height = 97, ;
Left = 24, ;
MultiSelect = .T., ;
Top = 180, ;
Width = 361, ;
Name = "lstDictionaries"
ADD OBJECT label1 AS label WITH ;
Caption = "Pick a Dictionary...", ;
Height = 13, ;
Left = 24, ;
Top = 162, ;
Width = 96, ;
Name = "Label1"
ADD OBJECT chkignorecase AS checkbox WITH ;
Top = 312, ;
Left = 168, ;
Height = 17, ;
Width = 182, ;
Caption = "Ignore Upper Case?", ;
Value = .F., ;
Name = "chkIgnoreCase"
PROCEDURE Init
This.oWord = CreateObject("word.application")
With This.lstDictionaries
For Each oDictionary In This.oWord.CustomDictionaries
Dictionaryitem = oDictionary.Path + "\" + oDictionary.Name
.AddItem(Dictionaryitem)
Next oDictionary
.listitemid = 1
EndWith
This.chkGrammar.Value = This.oWord.Options.CheckGrammarWithSpelling
This.chkIgnoreCase.Value = This.oWord.Options.IgnoreUpperCase
ENDPROC
PROCEDURE Destroy
This.oWord.Quit
ENDPROC
PROCEDURE edttext.Init
This.Value = "Thsi si a teset ot see fi thsi wil wrke ."
ENDPROC
PROCEDURE command1.Click
With Thisform.oWord
.Documents.add
.Selection.TypeText(ThisForm.edtText.Value)
.Visible = .T.
.Options.CheckGrammarWithSpelling = This.Parent.chkGrammar.Value
.Options.IgnoreUpperCase = This.Parent.chkIgnoreCase.Value
.CustomDictionaries.ActiveCustomDictionary = ;
.CustomDictionaries(ThisForm.lstDictionaries.ListItemID)
If This.Parent.chkGrammar.Value
.Activedocument.CheckGrammar
Else
.Activedocument.CheckSpelling
Endif
.Selection.WholeStory
ThisForm.edtText.Value = .Selection.Text
.ActiveDocument.Close(0)
.Visible = .F.
EndWith
ENDPROC
ENDDEFINE
*
*-- EndDefine: form1
**************************************************
>HI! EVERYONE!
>I have a question about MS word spell checker OLE.
>How can I useing MS word's Spell checker in VFP?
>
>any information?
>
>thanks.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only