Excel desde consola

Excel desde consola

Postby jrestojeda » Wed Jul 17, 2024 7:18 pm

Hola a todos,
Estoy tratando de leer un archivo Excel desde consola de la siguiente manera:

Code: Select all  Expand view

Static Function ProbandoExcel()

cFile :="MIEXCEL.XLSX"

oExcel:=TOleAuto():New("Excel.Application")
oBook :=oExcel:Workbooks:Open(cFile)
oHoja :=oExcel:Get( "ActiveSheet" )

nTotRowCount:= oHoja:UsedRange:Rows:Count()

FOR Q=1 TO nTotRowCount

   ALERT( oHoja:Cells( Q, 1 ):Value )
   ALERT( oHoja:Cells( Q, 2 ):Value )
   ALERT( oHoja:Cells( Q, 3 ):Value )
   ALERT( oHoja:Cells( Q, 4 ):Value )

NEXT

oExcel:WorkBooks:Close()
oExcel:Application:Quit()
RELEASE oHoja
RELEASE oExcel

Return nil
 


Me da el siguiente error de compilación:
Code: Select all  Expand view
Unresolved external '_HB_FUN_TOLEAUTO'


¿Debería agregar alguna lib adicional al proyecto?

Desde ya muchas gracias.
Saludos
Ojeda Esteban Eduardo.
Buenos Aires - Argentina.
FWH - PellesC - DBF/CDX - ADS - Gloriosos .Bat - MySql - C# .net - FastReport
Skype: jreduojeda
User avatar
jrestojeda
 
Posts: 601
Joined: Wed Jul 04, 2007 3:51 pm
Location: Buenos Aires - Argentina

Re: Excel desde consola

Postby Antonio Linares » Wed Jul 17, 2024 8:37 pm

Estás enlazando hbwin.lib de Harbour ?
regards, saludos

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

Re: Excel desde consola

Postby jrestojeda » Thu Jul 18, 2024 3:53 pm

Antonio,
Muchas gracias por su respuesta.
Ahí agregando la lib que me comentó compila sin problemas y genera el ejecutable, pero da el siguiente error en tiempo de ejecución.

Code: Select all  Expand view

ERROR DESCRIPTION
=================

Error en la aplicación: Y:\demo\DEMO.exe
Date: 18/07/24 Time: 12:46:34

(DOS Error -2147352570) WINOLE/1009  No exported method: GET
    TRIES: 0

Llamada desde: TOLEAUTO:GET........ Línea:      0
Llamada desde: PROBANDOEXCEL....... Línea:   2159
Llamada desde: MAIN................ Línea:     83

 


El código es el mismo que escribí inicialmente.
En FiveWin funciona normalmente.
Ojeda Esteban Eduardo.
Buenos Aires - Argentina.
FWH - PellesC - DBF/CDX - ADS - Gloriosos .Bat - MySql - C# .net - FastReport
Skype: jreduojeda
User avatar
jrestojeda
 
Posts: 601
Joined: Wed Jul 04, 2007 3:51 pm
Location: Buenos Aires - Argentina

Re: Excel desde consola

Postby Antonio Linares » Fri Jul 19, 2024 3:32 pm

Prueba a usar:

oHoja := oExcel:ActiveSheet

en vez de:

oHoja := oExcel:Get( "ActiveSheet" )
regards, saludos

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

Re: Excel desde consola

Postby jrestojeda » Fri Jul 19, 2024 5:58 pm

Perfecto Antonio,
Funcionó.
Muchas gracias.
Ojeda Esteban Eduardo.
Buenos Aires - Argentina.
FWH - PellesC - DBF/CDX - ADS - Gloriosos .Bat - MySql - C# .net - FastReport
Skype: jreduojeda
User avatar
jrestojeda
 
Posts: 601
Joined: Wed Jul 04, 2007 3:51 pm
Location: Buenos Aires - Argentina


Return to FiveWin para CA-Clipper

Who is online

Users browsing this forum: No registered users and 3 guests

cron