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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Spell Checking

Status
Not open for further replies.

jaa69

Programmer
Nov 12, 2001
85
US
Anyone hav any Ideas or know of any third Party Spell Checkers. I just need to Spell check a Memo Field while it is displayed still. Make corrections and save it. If anyone has an IDea about this please let me know.

 
Take a look at this recent thread.

thread184-713425

Brian
 
I use Chado Spell Checker

It's pretty good and easy to incorportae

Kevin Cotter
PES / Byron Schools
 
Here is some code to load Word and use Word's Spell Check. It's pretty simple. I have used it in the past and it works very well.

This sample assumes the data is in an an edit box. Go ahead and create a new form, add an edit box, then add a button and place this code in the button.

IF EMPTY(ThisForm.Edit1.Value)
RETURN
ENDIF

oWord = CreateObject("word.application")

With oWord
.Documents.add
.Selection.TypeText(ThisForm.Edit1.Value)
.Visible = .T.
.Activedocument.CheckSpelling
.Selection.WholeStory
.Selection.Copy
.ActiveDocument.Close(0)

.Quit
EndWith

ThisForm.Edit1.Value = _ClipText

MESSAGEBOX("Spell Check Complete.")

Jim Osieczonek
Delta Business Group, LLC
 
crossface,

Can you clearify. I don't know any reason why you can you the sample I provided for a distributed app. The user, of course, must have a licenced copy of Word, but other than that I don't see a problem with it.



Jim Osieczonek
Delta Business Group, LLC
 
I must have backspaced too many times. That para makes little sense. Let me try it again.

Can you clarify? I do not know any reason why you cannot use the sample I provided for a distributed app. The user, of course, must have a licensed copy of Word, but other than that, I do not see a problem with it.


Jim Osieczonek
Delta Business Group, LLC
 
Cool article Mike, I never heard of that product.

One little note, the article mentions you cannot use it from a menu on modal forms because the spellcheck menu is disabled. Although this is true, there are ways thru code to enable a particular menu item. Take a look at a menu.mpr and look at how it enables / disables menus. Then add the enable code in your init event of your form.

It's kind of sloppy, but it works. I would send sample code, but I did it so long ago I don't recall where the code is.



Jim Osieczonek
Delta Business Group, LLC
 
Jim,

there are ways thru code to enable a particular menu item. Take a look at a menu.mpr and look at how it enables / disables menus. Then add the enable code in your init event of your form.

I never knew you could do that. That is very useful. Thanks.

Of course, another option would be to invoke the spell checker from a toolbar button. That should work even from a modal form.

Mike



Mike Lewis
Edinburgh, Scotland
 
Thanks guys for all the help

I got this out of one of the FAQ'a that I was directed to.
IF EMPTY(ThisForm.Edit1.Value)
RETURN
ENDIF

oWord = CreateObject("word.application")

With oWord
.Documents.add
.Selection.TypeText(ThisForm.Edit1.Value)
.Visible = .T.
.Activedocument.CheckSpelling
.Selection.WholeStory
.Selection.Copy
.ActiveDocument.Close(0)

.Quit
EndWith

ThisForm.Edit1.Value = _ClipText

MESSAGEBOX("Spell Check Complete.")

That worked great. Except one thing. about 50% of the time after completing the Spell check the results would be blank, wipe everything out.

I put error checking in to make sure I did not blank out my Edit field. Does anyone know why it would return blank after completing the Spell check correctly?

 
I have never experience that problem. If it is coming back blank it is because the windows clipboard is empty. With the newer version of Word you can have several clipboards. Maybe it's a case where you need to tell Word what clipboard to use. If so, I'd start with Word help/documention to see how it handles the clipboards.



Jim Osieczonek
Delta Business Group, LLC
 
I was thinking the same thing it is picking up the wrong part of the clipboard. Ok will have to look into that. If anyone else has any ideas please let me know.

 
Jaa69.

Instead of this:

Selection.WholeStory
.Selection.Copy
...
ThisForm.Edit1.Value = _ClipText


you could try this:

ThisForm.Edit1.Value = .ActiveDocument.content.text

This avoids the use of the clipboard.

Mike



Mike Lewis
Edinburgh, Scotland
 
Mike,

I like that concept, but I believe Word is closed at that point and active document won't exist.

.Selection.Copy
.ActiveDocument.Close(0)




Jim Osieczonek
Delta Business Group, LLC
 
That's true. For some reason I was thinking Word had control at that point and not VFP. Must have been one too many cold ginger-ales last night.

Jim Osieczonek
Delta Business Group, LLC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top