As the header says, I have a problem exporting report to excel from the preview,
here is my code:
- Code: Select all Expand view RUN
STATIC FUNCTION SinDet(oWindow)
LOCAL oReporte,gCpt
LOCAL oFont1,oFont2,oFont3
LOCAL oPen1,oPen2
LOCAL nLinea := 1
LOCAL nHasta := 0
LOCAL cTitulo := "Reporte de pagos a cuentas de gastos"
// Record set de la tabla DETPCG
oRsCdg := FW_OpenRecordSet(oApp:oCon,"SELECT " +;
"*," +;
"CON_DES," +;
"HDR_PRV," +;
"HDR_PRO," +;
"PRO_NOM " +;
"FROM " +;
"DetCdg " +;
"LEFT JOIN " +;
"Conceptos " +;
"ON " +;
"DET_NI1 = Conceptos.CON_NI1 " +;
"AND " +;
"DET_NI2 = Conceptos.CON_NI2 " +;
"AND " +;
"DET_NI3 = Conceptos.CON_NI3 " +;
"AND " +;
"DET_NI4 = Conceptos.CON_NI4 " +;
"AND " +;
"DET_NI5 = Conceptos.CON_NI5 " +;
"LEFT JOIN " +;
"HdrCdg " +;
"ON " +;
"DET_FOL = HdrCdg.HDR_FOL " +;
"LEFT JOIN " +;
"Proveedores " +;
"ON " +;
"HDR_PRV = Proveedores.PRO_NUM " +;
"WHERE " +;
"HDR_PRO = '" + oVar:PRO + "' " +;
"AND " +;
"! HDR_CAN " +;
"ORDER BY " +;
"DET_NI1,DET_NI2,DET_NI3,DET_NI4,DET_NI5,DET_FOL",adLockOptimistic,adOpenDynamic,0)
IF oRsCdg == Nil
MsgStop("No pude abrir la tabla DETPCG !",oApp:cAplicacion)
FW_ShowAdoError(oApp:oCon)
Cierra()
RETURN(.F.)
ENDIF
IF oRsCdg:BOF() .AND. oRsCdg:EOF()
MsgStop("No hay pagos por cuentas de gastos para este proyecto !",oApp:cAplicacion)
RETURN(.F.)
ELSE
oRsCdg:MoveFirst()
nHasta := oRsCdg:RecordCount()
ENDIF
DEFINE FONT oFont1 NAME "ARIAL" SIZE 0,-09
DEFINE FONT oFont2 NAME "ARIAL" SIZE 0,-10 BOLD
DEFINE FONT oFont3 NAME "ARIAL" SIZE 0,-12 BOLD
DEFINE PEN oPen1 WIDTH 1 COLOR CLR_HBLUE
DEFINE PEN oPen2 WIDTH 1 COLOR CLR_HMAGENTA
REPORT oReporte CAPTION cTitulo PREVIEW;
HEADER AllTrim(oApp:cRazonSocial),;
AllTrim(oRsPro:Fields("CLI_NOM"):Value),oRsCdg:Fields("HDR_PRO"):Value,"",;
cTitulo,"" CENTER;
TITLE ALLTRIM(oRsPro:Fields("PRO_DES"):Value),;
"Fecha: "+Date2Txt(DATE(),,,,,,),;
"Página:"+STR(oReporte:nPage,3);
FONT oFont1,oFont2,oFont3;
PEN oPen1,oPen2
COLUMN TITLE "Folio" DATA oRsCdg:Fields("DET_FOL"):Value SIZE 6 RIGHT PICTURE "@Z 9999999"
COLUMN TITLE "Num" DATA oRsCdg:Fields("HDR_PRV"):Value SIZE 5 RIGHT PICTURE "@Z 99999"
COLUMN TITLE "Empleado" DATA oRsCdg:Fields("PRO_NOM"):Value SIZE 55 LEFT
COLUMN TITLE "Importe" DATA oRsCdg:Fields("DET_TOT"):Value SIZE 15 RIGHT PICTURE "@Z 99,999,999.99" TOTAL
GROUP gCpt ON Str(oRsCdg:Fields("DET_NI1"):Value,02,0) +;
Str(oRsCdg:Fields("DET_NI2"):Value,02,0) +;
Str(oRsCdg:Fields("DET_NI3"):Value,02,0) +;
Str(oRsCdg:Fields("DET_NI4"):Value,02,0) +;
Str(oRsCdg:Fields("DET_NI5"):Value,02,0) FOOTER " " FONT 2
// FOOTER Space(136) + "Total por concepto:" FONT 2
gCpt:bHeader := {|| "* Concepto: " + AllTrim(Str(oRsCdg:Fields("DET_NI1"):Value,02,0)) + "-" +;
AllTrim(Str(oRsCdg:Fields("DET_NI2"):Value,02,0)) + "-" +;
AllTrim(Str(oRsCdg:Fields("DET_NI3"):Value,02,0)) + "-" +;
AllTrim(Str(oRsCdg:Fields("DET_NI4"):Value,02,0)) + "-" +;
AllTrim(Str(oRsCdg:Fields("DET_NI5"):Value,02,0)) + " " +;
AllTrim(oRsCdg:Fields("CON_DES"):Value)}
END REPORT
IF oReporte:lCreated
oReporte:cGrandTotal := ""
oReporte:SetTxtColor(CLR_BLACK,1)
oReporte:SetTxtColor(CLR_HRED,2)
oReporte:SetTxtColor(CLR_HRED,3)
oReporte:SetPenColor(CLR_HBLUE)
oReporte:SetShdColor(CLR_YELLOW)
oReporte:oHeader:aFont[1] := {||3}
oReporte:oHeader:aFont[3] := {||3}
oReporte:oHeader:aPad[2] := RPT_LEFT
oReporte:oHeader:aPad[3] := RPT_RIGHT
oReporte:oTitle:aPad[1] := RPT_LEFT
oReporte:oTitle:aPad[2] := RPT_LEFT
oReporte:oTitle:aPad[3] := RPT_RIGHT
oReporte:lPageTotal := (.F.)
oReporte:oDevice:lPrvModal := (.T.)
oReporte:bInit := { || oRsCdg:MoveFirst() }
oReporte:bSkip := { || (nLinea++, oRsCdg:MoveNext())}
oReporte:bEndGroup := { |oGroup| TotalesGps(oReporte,oGroup) }
oReporte:bPostEnd := { || Totales(oReporte)}
ENDIF
ACTIVATE REPORT oReporte;
WHILE nLinea <= nHasta;
ON STARTPAGE (Alinea(oReporte,2,3,(.F.)),Alinea(oReporte,2,3))
oFont1:Release()
oFont2:Release()
oFont3:Release()
oPen1:Release()
oPen2:Release()
RETURN(.T.)
And this is the preview
And here is the error file
- Code: Select all Expand view RUN
Application
===========
Path and name: D:\SapWin30\SapWin30.Exe (32 bits)
Size: ********* bytes
Compiler version: Harbour 3.2.0dev (r1904111533)
FiveWin version: FWH 23.07
C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
Windows 11 64 Bits, version: 6.2, Build 9200
Time from start: 0 hours 0 mins 16 secs
Error occurred at: 21/11/2024, 10:13:53
Error description: (DOS Error -2147352567) WINOLE/1007 (0x800A03EC): CELLS
Args:
[ 1] = U
[ 2] = N 4
Stack Calls
===========
Called from: => TOLEAUTO:CELLS( 0 )
Called from: .\source\classes\REPORT.PRG => TREPORT:TOEXCEL( 2405 )
Called from: .\source\classes\RPREVIEW.PRG => (b)TPREVIEW( 101 )
Called from: .\source\classes\RPREVIEW.PRG => TPREVIEW:EXPORTTOMSEXCEL( 0 )
Called from: .\source\classes\RPREVIEW.PRG => (b)TPREVIEW_BUILDBUTTONBAR( 411 )
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:CLICK( 792 )
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:LBUTTONUP( 1083 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1847 )
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:HANDLEEVENT( 2135 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3693 )
Called from: => SYSREFRESH( 0 )
Called from: .\source\function\MSGRUN.PRG => STOPUNTIL( 72 )
Called from: .\source\classes\RPREVIEW.PRG => TPREVIEW:ACTIVATE( 179 )
Called from: .\source\classes\RPREVIEW.PRG => RPREVIEW( 1912 )
Called from: .\source\classes\REPORT.PRG => (b)TREPORT_NEW( 188 )
Called from: .\source\classes\REPORT.PRG => TREPORT:ACTIVATE( 920 )
Called from: Source\SapWin11g.Prg => SINDET( 273 )
Called from: Source\SapWin11g.Prg => VERDET( 139 )
Called from: Source\SapWin11g.Prg => (b)SAPWIN11G( 59 )
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:CLICK( 792 )
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:LBUTTONUP( 1083 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1847 )
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:HANDLEEVENT( 2135 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3693 )
Called from: => DIALOGBOX( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 307 )
Called from: Source\SapWin11g.Prg => SAPWIN11G( 69 )
Called from: Source\SapWin.prg => (b)MAIN( 727 )
Called from: .\source\classes\TRBTN.PRG => TRBTN:CLICK( 717 )
Called from: .\source\classes\TRBTN.PRG => TRBTN:LBUTTONUP( 920 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1847 )
Called from: .\source\classes\TRBTN.PRG => TRBTN:HANDLEEVENT( 1578 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3693 )
Called from: => WINRUN( 0 )
Called from: .\source\classes\WINDOW.PRG => TMDIFRAME:ACTIVATE( 1118 )
Called from: Source\SapWin.prg => MAIN( 1191 )
System
======
CPU type: AMD Ryzen 5 5500U with Radeon Graphics 2096 Mhz
Hardware memory: 15755 megs
Free System resources: 90 %
GDI resources: 90 %
User resources: 90 %
Windows total applications running: 5
1 ,
2 , C:\WINDOWS\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.22621.3527_none_fbe8b
3 , C:\WINDOWS\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.22621.4391_none_6ec30a
4 , D:\SapWin30\SapWin30.Exe
5 GDI+ Window (AsusOSD.exe), C:\WINDOWS\WinSxS\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.22621.4455_none_9fa9a0cfe292e2
Variables in use
================
Procedure Type Value
==========================
TOLEAUTO:CELLS
Param 1: O Class: ERROR
TREPORT:TOEXCEL
Param 1: U
Param 2: N 4
Local 1: U
Local 2: U
(b)TPREVIEW
Local 1: U
Local 2: O Class: TOLEAUTO
Local 3: O Class: TOLEAUTO
Local 4: O Class: TOLEAUTO
Local 5: O Class: TOLEAUTO
Local 6: N 6
Local 7: N 6
Local 8: N 5
Local 9: N 4
Local 10: N 4
Local 11: N 1
Local 12: N 2
Local 13: O Class: TRCOLUMN
Local 14: C "@Z 99,999,999.99"
Local 15: C "$1:$6"
Local 16: N 2
Local 17: A Len: 4
Local 18: A Len: 4
Local 19: L .T.
Local 20: L .T.
Local 21: N 12.00
Local 22: U
Local 23: N 3
Local 24: L .T.
Local 25: N 1
Local 26: A Len: 1
Local 27: A Len: 1
Local 28: A Len: 1
Local 29: N 1
Local 30: U
Local 31: O Class: TOLEAUTO
Local 32: N 0
Local 33: C "SUBTOTAL(9,"
Local 34: U
Local 35: S @RANGE()
Local 36: O Class: TOLEAUTO
TPREVIEW:EXPORTTOMSEXCEL
Param 1: O Class: TPREVIEW
(b)TPREVIEW_BUILDBUTTONBAR
TBTNBMP:CLICK
Param 1: O Class: TBTNBMP
TBTNBMP:LBUTTONUP
TCONTROL:HANDLEEVENT
Param 1: N 20
Param 2: N 6
Param 3: N 0
Local 1: L .T.
Local 2: N 0
Local 3: S @CLICK()
TBTNBMP:HANDLEEVENT
Param 1: N 514
Param 2: N 0
Param 3: N 1310726
Local 1: U
_FWH
Param 1: N 514
Param 2: N 0
Param 3: N 1310726
SYSREFRESH
Param 1: N 1310726
Param 2: N 514
Param 3: N 0
Param 4: N 1310726
Param 5: N 150
Local 1: O Class: TBTNBMP
STOPUNTIL
TPREVIEW:ACTIVATE
Param 1: B {|| ... }
RPREVIEW
Local 1: O Class: TPREVIEW
Local 2: N 199594
(b)TREPORT_NEW
Param 1: O Class: TPRINTER
Param 2: O Class: TREPORT
Local 1: O Class: TPREVIEW
TREPORT:ACTIVATE
Param 1: O Class: TPRINTER
SINDET
Param 1: B {|| ... }
Param 2: B {|| ... }
Param 3: U
Param 4: U
Param 5: B {|| ... }
Param 6: U
Param 7: U
Param 8: U
Param 9: U
Param 10: U
Param 11: U
Param 12: U
Param 13: U
Param 14: U
Local 1: O Class: TREPORT
Local 2: O Class: TSAY
Local 3: N 199646
VERDET
Param 1: O Class: TMDIFRAME
Local 1: O Class: TREPORT
Local 2: O Class: TRGROUP
Local 3: O Class: TFONT
Local 4: O Class: TFONT
Local 5: O Class: TFONT
Local 6: O Class: TPEN
Local 7: O Class: TPEN
Local 8: N 35
Local 9: N 34
Local 10: C "Reporte de pagos a cuentas de gastos"
(b)SAPWIN11G
Param 1: O Class: TMDIFRAME
TBTNBMP:CLICK
Param 1: O Class: TBTNBMP
TBTNBMP:LBUTTONUP
TCONTROL:HANDLEEVENT
Param 1: N 11
Param 2: N 50
Param 3: N 0
Local 1: L .T.
Local 2: N 0
Local 3: S @CLICK()
TBTNBMP:HANDLEEVENT
Param 1: N 514
Param 2: N 0
Param 3: N 720946
Local 1: U
_FWH
Param 1: N 514
Param 2: N 0
Param 3: N 720946
DIALOGBOX
Param 1: N 720946
Param 2: N 514
Param 3: N 0
Param 4: N 720946
Param 5: N 135
Local 1: O Class: TBTNBMP
TDIALOG:ACTIVATE
Param 1: N 4194304
Param 2: C "QryPcg"
Param 3: N 199594
Param 4: O Class: TDIALOG
SAPWIN11G
Param 1: U
Param 2: U
Param 3: U
Param 4: L .T.
Param 5: B {|| ... }
Param 6: L .T.
Param 7: U
Param 8: U
Param 9: U
Param 10: U
Param 11: U
Param 12: L .F.
Param 13: O Class: TDIALOG
Param 14: U
Local 1: N 199594
Local 2: S @_NRESULT()
Local 3: O Class: TDIALOG
(b)MAIN
Param 1: O Class: TMDIFRAME
Local 1: O Class: TDIALOG
Local 2: O Class: TFONT
Local 3: O Class: TICON
Local 4: A Len: 1
Local 5: A Len: 2
Local 6: O Class: TBTNBMP
TRBTN:CLICK
Param 1: O Class: TRBTN
TRBTN:LBUTTONUP
TCONTROL:HANDLEEVENT
Param 1: N 66
Param 2: N 36
Param 3: N 0
Local 1: L .T.
Local 2: L .T.
Local 3: S @CLICK()
TRBTN:HANDLEEVENT
Param 1: N 514
Param 2: N 0
Param 3: N 4325412
Local 1: U
_FWH
Param 1: N 514
Param 2: N 0
Param 3: N 4325412
WINRUN
Param 1: N 4325412
Param 2: N 514
Param 3: N 0
Param 4: N 4325412
Param 5: N 88
Local 1: O Class: TRBTN
TMDIFRAME:ACTIVATE
Param 1: N 199594
MAIN
Param 1: C "MAXIMIZED"
Param 2: U
Param 3: U
Param 4: U
Param 5: U
Param 6: B {|| ... }
Param 7: U
Param 8: U
Param 9: U
Param 10: U
Param 11: U
Param 12: U
Param 13: U
Param 14: U
Param 15: U
Param 16: U
Param 17: B {|| ... }
Param 18: U
Param 19: U
Param 20: L .F.
Local 1: O Class: TMDIFRAME
Local 2: U
Local 3: U
Linked RDDs
===========
DBF
DBFFPT
DBFBLOB
DBFNTX
DataBases in use
================
Classes in use:
===============
1 ERROR
2 HBCLASS
3 HBOBJECT
4 TWINDOW
5 TCONTROL
6 TGET
7 TAPLICACION
8 TINI
9 WIN_OLEAUTO
10 TOLEAUTO
11 TPUBLIC
12 TICON
13 TBRUSH
14 TMDIFRAME
15 TMENU
16 TREG32
17 TMDICLIENT
18 TFONT
19 TRIBBONBAR
20 TRPANEL
21 TRBGROUP
22 TRBTN
23 TMSGBAR
24 TRECT
25 TMSGITEM
26 TTIMER
27 TBITMAP
28 TIMAGE
29 TDIALOG
30 TSAY
31 GET
32 TCLIPGET
33 TCHECKBOX
34 TBTNBMP
35 TPEN
36 TREPORT
37 TPRINTER
38 TRLINE
39 TRCOLUMN
40 TRGROUP
41 TBUTTON
42 TPREVIEW
43 TMENUITEM
44 TSCROLLBAR
45 TCURSOR
46 TBAR
47 TIMAGELIST
48 TLISTVIEW
49 TMETAFILE
50 TCOMBOBOX
51 TSTRUCT
Memory Analysis
===============
1682 Static variables
Dynamic memory consume:
Actual Value: 3538944 bytes
Highest Value: 3538944 bytes
Thanks for your help
Whit best regards