#include "FiveWin.ch"
#include "report.ch"
#include "inkey.ch"
Function main()
LOCAL oFont1, oFont2
LOCAL oReport
DEFINE FONT oFont1 NAME "ARIAL" SIZE 0,-10
DEFINE FONT oFont2 NAME "ARIAL" SIZE 0,-10 BOLD
SetKey(VK_F2, { || oReport:ToExcel() })
USE TEST NEW
dbgotop()
REPORT oReport TITLE "*** Mi Primer Reporte ***" ;
FONT oFont1, oFont2 ;
PREVIEW CAPTION "Mensaje del título"
//oReport:bPreInit:= { || DbGoTop() }
COLUMN TITLE "St" DATA Test->State
COLUMN TITLE "Nombre", "Apellido" ;
DATA Test->First, Test->Last
COLUMN TITLE "Direccion", "Ciudad" ;
DATA Test->Street, Test->City
COLUMN TITLE " Salario" ;
DATA Test->Salary ;
TOTAL ;
RIGHT ;
PICTURE "9,999,999";
FONT 2 ;
SIZE 9
END REPORT
ACTIVATE REPORT oReport
CLOSE TEST
oFont1:End()
oFont2:End()
RETURN NIL
if lTotal
for nCol := 1 to nCols
oCol := ::aColumns[ nCol ]
if oCol:lTotal
WITH OBJECT oSheet:Cells( nRow, nCol )
//:Formula := "=SUBTOTAL( 9, " + ;
// oSheet:Range( oSheet:Cells( nFirstRow, nCol ), ;
// oSheet:Cells( nRow - 1, nCol ) ):Address( .f., .f. ) + ")"
END
if ( nFont := Eval( oCol:bTotalFont ) ) != aFont[ nCol ]
::xlSetFont( oSheet:Cells( nRow, nCol ), ::aFont[ nFont ] )
endif
endif
next
endif
Error description: (DOS Error -2147352567) WINOLE/1006 Argument error: _FORMULA
Args:
[ 1] = C =SUBTOTAL( 9, D4:D5)
lucasdebeltran wrote:Yes, with your code it is working fine:
oReport:bInit := { || TEST->( dbGoTop() ) }
But, does not do it automatically Treport?.
Can´t it be done by default in ToExcel() method?.
Sure, in spanish function SUBTOTAL is SUBTOTALES.
But I still get the error.
I use Excel 2003.
oSheet:Cells( nRow, nCol ):Formula := "=SUBTOTAL(9," + cAdr + ")"
oSheet:Cells( nRow, nCol ):Formula := "=SUBTOTALES(9;" + cAdr + ")"
carlos vargas wrote:me parece que pueedes usar el metodo del propio xbrowse
::GoTop()
ya que este metodo hara el salto al primer registro
y ya se encarga de determinar si es un rdd o un array.
salu2
carlos vargas
But it is a good idea to create a new method in TReport, oreport:gotop(), so it´s called in ToExcel() method at beginning: ::gotop()
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 113 guests