FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour spell check with word activex
Posts: 566
Joined: Thu Aug 30, 2007 03:40 PM
spell check with word activex
Posted: Thu Jun 17, 2010 01:57 PM

HI, someone already try use an way to use spell check with ms word, maybe using activex?
i need make spell check in memo , in portuguese-br , someone try this?
thanks

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: spell check with word activex
Posted: Thu Jun 17, 2010 04:03 PM

I have not used it, but others here are using this spell checker with FWH.

http://www.wintertree-software.com/dev/ ... ml#Catalog

It is US$399 and you can get a Brazilian dictionary.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: spell check with word activex
Posted: Thu Jun 17, 2010 09:59 PM

Friends:

Yes, I have a little function to use the ms-word spell checker, if it can help
I can post it.

Regards

SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 566
Joined: Thu Aug 30, 2007 03:40 PM
Re: spell check with word activex
Posted: Thu Jun 17, 2010 11:38 PM

Armando, please...

Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: spell check with word activex
Posted: Fri Jun 18, 2010 03:38 AM
Friends:

Here is

This is the way to call the SpellCheck function
Code (fw): Select all Collapse
oPro:DES := SpellCheck(oPro:DES)


And here is the SpellCheck function
Code (fw): Select all Collapse
STATIC FUNCTION SpellCheck(Texto)
LOCAL oWord,oDoc,oTexto
LOCAL cText:=Texto

oWord:=TOleAuto():New( "Word.Application" )
oWord:Visible := .F.
oWord:Documents:Add()
oDoc := oWord:Get("ActiveDocument")

oTexto := oWord:Selection()
oTexto:Text := Texto

oDoc:CheckSpelling()

cText := oTexto:Text

oDoc:Close(0)
oWord:Quit()
oTexto:=NIL
oDoc:=NIL
oWord:=NIL


IF ! EMPTY(cText) // If ctext is empty that means that the process was canceled
    Texto := cText
ENDIF
RETURN(Texto)


With best regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 566
Joined: Thu Aug 30, 2007 03:40 PM
Re: spell check with word activex
Posted: Fri Jun 18, 2010 12:37 PM

HI Armando, very thanks, works very fine... :D let me ask : if i want know if word is present in computer? maybe an function :?:

Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: spell check with word activex
Posted: Fri Jun 18, 2010 02:08 PM

Norberto:

Oppps, I don't know :oops: , perhaps somebody can help us, or Test and error .

Sorry

SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 389
Joined: Mon Oct 13, 2008 11:26 AM
Re: spell check with word activex
Posted: Fri Jun 18, 2010 02:52 PM
norberto wrote:HI Armando, very thanks, works very fine... :-) let me ask : if i want know if word is present in computer? maybe an function :-)


You could look in the register, I suggest you to install 98, 2003, 2007 and 2010 in your computer to look what register is created
Email: SamirSSabreu@gmail.com
xHarbour 1.2.3 + Fwhh 20.2
Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
Re: spell check with word activex
Posted: Fri Jun 18, 2010 03:35 PM
you can test like this

Code (fw): Select all Collapse
   TRY
      oWORD := CREATEOBJECT( "word.Application" )
   CATCH
      TRY
         oWORD := CREATEOBJECT( "word.Application" )
      CATCH
       // no word is installed
         RETURN NIL
      END
   END
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: spell check with word activex
Posted: Fri Jun 18, 2010 05:17 PM
Richard,

Please explain why you need two TRY/CATCHes?

Wouldn't something like this work?

James

Code (fw): Select all Collapse
isWord()
   local lSuccess:=.F.
   local oWord
   TRY 
      oWord:= createObject("word.Application")
      lSuccess:=.T.
    CATCH
       lSuccess:=.F.
    END
return lSuccess
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 566
Joined: Thu Aug 30, 2007 03:40 PM
Re: spell check with word activex
Posted: Fri Jun 18, 2010 05:21 PM

Hi, i use :

.....
TRY
oWord:=TOleAuto():New( "Word.Application" )
CATCH
Msginfo( "Word não instalado!!" )
Return(Texto)
END
....
and works fine.
why some people use toleauto and another createobject, is the same??

thanks

Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
Re: spell check with word activex
Posted: Fri Jun 18, 2010 06:52 PM

James

This code has been in my application since quite a while and running ok

From my notes, Ole prompted error many times at first try , this is why i embedded try catch to solve this and it solved it at that time.

Maybe now , only one try/catch is enough ,

My purpose was just to show the way testing ms word's presence

HTH

Richard

http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: spell check with word activex
Posted: Fri Jun 18, 2010 09:05 PM

Richard,

I wasn't being critical--I figured you had a reason and it seems you did. Even if two aren't needed always it is probably better to use them if there is a possibility of a false error.

Thanks for the sample.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 654
Joined: Fri Oct 21, 2005 05:54 AM
Re: spell check with word activex
Posted: Sat Jun 19, 2010 08:32 AM

Hi,

Once the spell check is completed, I am getting a dialog with following messages:

"This file is in use by another application or user."
(C:\Documents and Settings..\Normaldot)

and also getting

Save as dialog box.

How to avoid this.

Regards,

  • Ramesh Babu P
Posts: 990
Joined: Thu Nov 17, 2005 05:49 PM
Re: spell check with word activex
Posted: Fri Jun 25, 2010 01:16 AM
Hi everyone.

I'm using a dll that you only purchase once and is then distributable with your app. It works well and you don't need to have word installed on the computer. In the long (or even short) run it is less expensive than having Word on the workstation. It has very many functions and it might work just like the word's spell checker where you may even suggest and show errors as the user types. The product is called SSCE and the company is Wintertree. I highly recommend it. Here is some sample code where I'm using it. This will check for errors the text on the hWnd window handle:
Code (fw): Select all Collapse
                SSCE_CheckCtrlBackgroundRecheckAll( ::oActive:hWnd, SSCE_OPTION, RGB( 254, 1, 1 ) ), ),;


Here as the user presses the space bar I check if the word is misspelled:
Code (fw): Select all Collapse
        CASE nKey == 32 
            SSCE_CheckCtrlBackgroundNotify( ::oActive:hWnd, SSCE_OPTION, RGB(254, 1, 1) )


In both of these samples, if the word is misspelled, it will be shown as RGB( 254, 1, 1 ).

It has worked very good for me. I hope it helps others.

Reinaldo.

Continue the discussion