Excel OLE RTE when compiled with Harbour

Excel OLE RTE when compiled with Harbour

Postby hua » Tue Aug 23, 2022 6:34 am

Hi guys,
I'm trying to migrate a module that I have to FWH+Harbour instead of xHb
However this line of code generates RTE under Harbour but ran fine all this while under xHb
Code: Select all  Expand view
 ::oSheet := ::oExcel:ActiveSheet
 ::oSheet:set("Name", "A & T ELEC")
 


The error was
FiveWin version: FWH 19.05
C compiler version: Borland/Embarcadero C++ 7.3 (32-bit)
Windows version: 10.0, Build 18363

Time from start: 0 hours 0 mins 18 secs
Error occurred at: 23/08/2022, 14:28:59
Error description: (DOS Error -2147352572) WINOLE/1007 Argument error: SET
Args:
[ 1] = C Name
[ 2] = C A & T ELEC

Stack Calls
===========
Called from: => TOLEAUTO:SET( 0 )
Called from: .\statprnx.PRG => STATPRNXLS:HEADER( 136 )


Anyone has any idea of how to solve this?
TIA
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: Excel OLE RTE when compiled with Harbour

Postby Antonio Linares » Tue Aug 23, 2022 6:45 am

Dear Hua,

Please try it again removing the "&" to see if that makes a difference:

::oSheet:set("Name", "A T ELEC")
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42054
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Excel OLE RTE when compiled with Harbour

Postby hua » Tue Aug 23, 2022 7:15 am

Thanks for the prompt reply Antonio.

Removing '&' didn't help. The same error occured
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: Excel OLE RTE when compiled with Harbour

Postby cnavarro » Tue Aug 23, 2022 7:50 am

Try with
Code: Select all  Expand view

::oSheet := ::oExcel:ActiveSheet
 ::oSheet:name := "A & T ELEC"
 
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Excel OLE RTE when compiled with Harbour

Postby hua » Tue Aug 23, 2022 8:28 am

Thanks Cristobal! That was it :)
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: Excel OLE RTE when compiled with Harbour

Postby hua » Wed Aug 24, 2022 2:02 am

Another error I found after compiling with Harbour. Instead of a logical value, lRetVal ends up with an array {0, 5813120}
Code: Select all  Expand view

      lRetVal := StatPrnXls():activate(cTitle, cFrom, cTo, dCOD, lPrnZero)
      return lRetVal


I don't even know where to begin to find out what went wrong. The last line in StatPrnXls():activate() simply returns .t. and yet lRetVal ends up with an array

Any tips? Suggestions?
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: Excel OLE RTE when compiled with Harbour

Postby Antonio Linares » Wed Aug 24, 2022 6:37 am

You could try this:

instead of
return lRetVal

use
return lRetVal[ 2 ] != 0
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42054
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Excel OLE RTE when compiled with Harbour

Postby hua » Thu Aug 25, 2022 1:56 am

Whether StatPrnXls():activate() returns .t. or .f. lRetVal always ends up with {0, 5813120}

I can't wrap my mind on what's happening. Called class returns a logical value yet lRetVal ends up with an array
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: Excel OLE RTE when compiled with Harbour

Postby nageswaragunupudi » Mon Aug 29, 2022 10:05 am

May I know what is this "StatPrnXls()" ?
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10604
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Excel OLE RTE when compiled with Harbour

Postby nageswaragunupudi » Mon Aug 29, 2022 10:05 am

May I know what is this "StatPrnXls()" ?
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10604
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Excel OLE RTE when compiled with Harbour

Postby hua » Tue Aug 30, 2022 2:35 am

Hi Rao,
StatPrnXls() is a class in my program that generates a report directly in Excel using OLE.
The last line in StatPrnCls():activate() is return .t. hence my bewilderment when lRetVal contains an array
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: Excel OLE RTE when compiled with Harbour

Postby nageswaragunupudi » Tue Aug 30, 2022 3:03 am

Nice.
Do you mind sharing your class with me?
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10604
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Excel OLE RTE when compiled with Harbour

Postby hua » Tue Aug 30, 2022 3:28 am

It's just a crude report written in class form as I try to avoid using public,private variable as much as possible :)
Irregardless, I've emailed it to you.
Thank you
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: Excel OLE RTE when compiled with Harbour

Postby nageswaragunupudi » Tue Aug 30, 2022 7:52 am

Thank you
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10604
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Excel OLE RTE when compiled with Harbour

Postby nageswaragunupudi » Tue Aug 30, 2022 9:56 am

I remember having experienced the same problem, when I was writing the METHOD ToExcel() of XBrowse.
Please see my notes towards the end of ToExcel() method in XBrowse.
Code: Select all  Expand view

#ifndef __XHARBOUR__
   else
      //
      SysRefresh()
      //
      // This requires explanation.
      // With xHarbour there is no problem. Problem is with Harbour only
      // return value of this function is oSheet which is an Object. xHarbour returns as object
      // If SysRefresh() is called here, Harbour returns oSheet as an object
      // if not it returns an Array of two numeric elements.
      // I am unable to understand this phenomenon.
      // Till we understand what is happening, keep SysRefresh() here for
      // Harbour build.
      // 2015-06-02
#endif
   endif

return oSheet
 


So, in your case also I guess xHarbour returns .T. but Harbour returns an array of two numeric elements.

Please insert
Code: Select all  Expand view
SysRefresh()

just beore
Code: Select all  Expand view
return .t.


I expect this will solve your problem.
Please test and let us know the result.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10604
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Next

Return to FiveWin for Harbour/xHarbour

Who is online

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