spell check with word activex

spell check with word activex

Postby norberto » Thu Jun 17, 2010 1: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
norberto
 
Posts: 566
Joined: Thu Aug 30, 2007 3:40 pm
Location: BR

Re: spell check with word activex

Postby James Bott » Thu Jun 17, 2010 4: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: spell check with word activex

Postby Armando » Thu Jun 17, 2010 9: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
User avatar
Armando
 
Posts: 3217
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: spell check with word activex

Postby norberto » Thu Jun 17, 2010 11:38 pm

Armando, please...
norberto
 
Posts: 566
Joined: Thu Aug 30, 2007 3:40 pm
Location: BR

Re: spell check with word activex

Postby Armando » Fri Jun 18, 2010 3:38 am

Friends:

Here is

This is the way to call the SpellCheck function
Code: Select all  Expand view

oPro:DES := SpellCheck(oPro:DES)
 


And here is the SpellCheck function
Code: Select all  Expand view

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
User avatar
Armando
 
Posts: 3217
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: spell check with word activex

Postby norberto » 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 :?:
norberto
 
Posts: 566
Joined: Thu Aug 30, 2007 3:40 pm
Location: BR

Re: spell check with word activex

Postby Armando » Fri Jun 18, 2010 2: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
User avatar
Armando
 
Posts: 3217
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: spell check with word activex

Postby sambomb » Fri Jun 18, 2010 2:52 pm

norberto wrote:HI Armando, very thanks, works very fine... :D 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
User avatar
sambomb
 
Posts: 388
Joined: Mon Oct 13, 2008 11:26 am
Location: Itaocara - RJ - Brasil

Re: spell check with word activex

Postby Richard Chidiak » Fri Jun 18, 2010 3:35 pm

you can test like this

Code: Select all  Expand view


   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
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Re: spell check with word activex

Postby James Bott » Fri Jun 18, 2010 5:17 pm

Richard,

Please explain why you need two TRY/CATCHes?

Wouldn't something like this work?

James

Code: Select all  Expand view
isWord()
   local lSuccess:=.F.
   local oWord
   TRY
      oWord:= createObject("word.Application")
      lSuccess:=.T.
    CATCH
       lSuccess:=.F.
    END
return lSuccess
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: spell check with word activex

Postby norberto » Fri Jun 18, 2010 5: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
norberto
 
Posts: 566
Joined: Thu Aug 30, 2007 3:40 pm
Location: BR

Re: spell check with word activex

Postby Richard Chidiak » Fri Jun 18, 2010 6: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
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Re: spell check with word activex

Postby James Bott » Fri Jun 18, 2010 9: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: spell check with word activex

Postby RAMESHBABU » Sat Jun 19, 2010 8: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
User avatar
RAMESHBABU
 
Posts: 624
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

Re: spell check with word activex

Postby reinaldocrespo » Fri Jun 25, 2010 1: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: Select all  Expand view
                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: Select all  Expand view
        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.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 79 guests