I'm Trying to use method ToCalc, but when I invoque the method ToCalc, ocurs an error.
SetExcelLanguage() is called if nxlLangID= NIL, and this function try to create object "Excel.Application", if we are using Harbour and haven't Excel ocurs the present error. With xHarbour no error because of the TRY ... CATCH.
So we can add TRY ... CATCH if compiler is harbour.
Or really if we are working with Open Office, usually we don't have Excel installed, so we can assign 0 to nxlLangID at the begin of method ToCalc.
Note to use TRY ... CATH in harbour
Actually included in Fivewin.ch
Application
===========
Path and name: G:\fwh\Biel\EA6DDlog\EA6DDlog.Exe (32 bits)
Size: 2,203,648 bytes
Time from start: 0 hours 0 mins 16 secs
Error occurred at: 18-02-09, 13:04:12
Error description: Error TOleAuto/65535 : TOLEAUTO:NEW
Args:
[ 1] = C Excel.Application
Stack Calls
===========
Called from: .\win_tole.prg => THROW(79)
Called from: => TOLEAUTO:NEW(252)
Called from: G:\fwh\Clases no modificadas\xbrowse.prg => SETEXCELLANGUAGE(5853)
Called from: => TXBRWCOLUMN:CLPTEXT(8139)
SetExcelLanguage() is called if nxlLangID= NIL, and this function try to create object "Excel.Application", if we are using Harbour and haven't Excel ocurs the present error. With xHarbour no error because of the TRY ... CATCH.
So we can add TRY ... CATCH if compiler is harbour.
#ifdef __XHARBOUR__
TRY
oExcel := GetActiveObject( "Excel.Application" )
CATCH
TRY
oExcel := CreateObject( "Excel.Application" )
CATCH
nxlLangID := 0
return nil
END
END
lLocal := .t.
#else
TRY //<============Biel
oExcel := TOLEAuto():New( "Excel.Application" )
CATCH
nxlLangID:=0
RETURN NIL
END
#endifOr really if we are working with Open Office, usually we don't have Excel installed, so we can assign 0 to nxlLangID at the begin of method ToCalc.
METHOD ToCalc( bProgress, nGroupBy, nPasteMode, aSaveAs ) CLASS TXBrowse
local oCalc, oDeskTop,oBook, oSheet, oWin, oLocal, oDispatcher
local nCol, nXCol, oCol, cType, uValue
local uBookMark, nRow
local nDataRows
local aCols
local oClip, cText, nPasteRow, nStep, cFormat,cFileName,cURL,i
local aTotals := {}, lAnyTotals := .f. , aProp:={} , aOOFilters:={} , nPos, oCharLocale
DEFAULT nPasteMode:=1
DEFAULT aSaveAs:={}
DEFAULT nxlLangId:=0 //<===BielNote to use TRY ... CATH in harbour
static bError
#xcommand TRY => bError := errorBlock( {|oErr| break( oErr ) } ) ;;
BEGIN SEQUENCE
#xcommand CATCH [<!oErr!>] => errorBlock( bError ) ;;
RECOVER [USING <oErr>] <-oErr-> ;;
errorBlock( bError )Actually included in Fivewin.ch