Report rpreview excel button disable not work-SOLVED
Posted:
Wed Apr 24, 2024 11:02 am
by richard-service
Dear Antonio,
These code working fine FWH2212, but not work FWH2402 and FWH2404.
- Code: Select all Expand view
LOCAL oReport, oFont[4]
LOCAL nI := 0
LOCAL nRows := 0
LOCAL nSel := 0
cOFFER_NO := AllTrim( FW_UTF8PADCHAR(cOFFER_NO, 10) )
cOFFER_NM := AllTrim( FW_UTF8PADCHAR(cOFFER_NM, 50) )
cOFFER_NO := "%" + cOFFER_NO + "%"
cOFFER_NM := "%" + cOFFER_NM + "%"
DO CASE
CASE nRdo1 == 1
::oDB:cQuery := "SELECT * FROM OfferMsf WHERE OFFER_NO LIKE'"+cOFFER_NO+"'"
::oDB:Refresh()
::oBrw:Refresh()
::oBrw:GoTop()
Dr_SetFocus( ::oBrw )
CASE nRdo1 == 2
::oDB:cQuery := "SELECT * FROM OfferMsf WHERE OFFER_NM LIKE'"+cOFFER_NM+"'"
::oDB:Refresh()
::oBrw:Refresh()
::oBrw:GoTop()
Dr_SetFocus( ::oBrw )
ENDCASE
IF ::oDB:LastRec() == 0
MsgAlert("資料檔中無任何資料,無法列印 !","警告")
RETURN NIL
ENDIF
DEFINE FONT oFont[1] NAME "MingLiU" SIZE 0,12
DEFINE FONT oFont[2] NAME "DFKai-SB" SIZE 0,16 BOLD
DEFINE FONT oFont[3] NAME "MingLiU" SIZE 0,12 BOLD
DEFINE FONT oFont[4] NAME "DFKai-SB" SIZE 0,22 BOLD
DO CASE
CASE nPreView == 1 // 報表先預覽後列印
REPORT oReport ;
TITLE Trim("廠商基本資料報表") ,;
"" ,;
"列印區間:"+ iif ( nRdo1=1, cOFFER_NO, cOFFER_NM ) + space(5) + ;
"列印日期:"+DTOC(DATE())+ REPL(" ",12) + ;
"頁次: "+str(oReport:nPage,3) CENTER ;
HEADER GetRegName() ,;
" " CENTER ;
FONT oFont[1],oFont[2],oFont[3],oFont[4] ;
CAPTION "廠商基本資料報表" ;
PREVIEW
CASE nPreView == 2 // 報表直接從印表機列印
REPORT oReport ;
TITLE Trim("廠商基本資料報表") ,;
"" ,;
"列印區間:"+ iif ( nRdo1=1, cOFFER_NO, cOFFER_NM ) + space(5) + ;
"列印日期:"+DTOC(DATE())+ REPL(" ",12) + ;
"頁次: "+str(oReport:nPage,3) CENTER ;
HEADER GetRegName() ,;
" " CENTER ;
FONT oFont[1],oFont[2],oFont[3],oFont[4] ;
CAPTION "廠商基本資料報表" ;
TO PRINTER
ENDCASE
COLUMN TITLE "廠商編號" DATA ::oDB:OFFER_NO
COLUMN TITLE "廠商簡稱" DATA ::oDB:OFFER_NM2
COLUMN TITLE "統一編號" DATA ::oDB:OFFER_ID
COLUMN TITLE "負責人" DATA ::oDB:BOSS
COLUMN TITLE "聯絡人1" DATA ::oDB:CONTACT1
COLUMN TITLE "電話1" DATA ::oDB:TEL1
COLUMN TITLE "傳真" DATA ::oDB:FAX
COLUMN TITLE "行動電話1" DATA ::oDB:MOBIL1
END REPORT
IF oReport:lCreated
oReport:oHEADER:aFONT[1]:={|| 4 }
oReport:oTITLE:aFONT[1]:={|| 2 }
oReport:oTITLE:aFONT[2]:={|| 1 }
oReport:oTITLE:aFONT[3]:={|| 1 }
oReport:cPageTotal := "分頁小計..."
oReport:cGrandTotal := "總計金額..."
oReport:nTotalLine := RPT_SINGLELINE
oReport:bInit := {|| ::oDB:GoTop() }
oReport:bSkip := {|| ::oDB:Skip() }
ENDIF
FOR nI=1 TO LEN(oReport:aColumns)
oReport:aColumns[nI]:bTitleFont := {|| 3 }
NEXT
ACTIVATE REPORT oReport WHILE !::oDB:EOF() ON STARTGROUP oReport:NewLine()
oFont[1]:End()
oFont[2]:End()
oFont[3]:End()
oFont[4]:End()
RETURN NIL
Re: Report rpreview excel button disable not work
Posted:
Thu Apr 25, 2024 2:14 am
by richard-service
Dear Karinha,
Yes, I saw full suggestion and samples.
But I don't know where set error or need to add some code.
Any idea to study it?
Re: Report rpreview excel button disable not work
Posted:
Fri Apr 26, 2024 3:03 am
by richard-service
karinha wrote:Maybe:
- Code: Select all Expand view
FOR nI = 1 TO Len( oReport:aColumns )
oReport:aColumns[ nI ]:bTitleFont := {|| 3 }
NEXT
oReport:bInit := {|| ::oDB:GoTop() }
oReport:bSkip := {|| ::oDB:Skip() }
// .OR.
// oRep:bInit := { || ::oDB:MoveFirst() }
// oRep:bSkip := { || ::oDB:MoveNext() }
ACTIVATE REPORT oReport WHILE .NOT. ::oDB:Eof() ;
ON STARTGROUP oReport:NewLine()
oFont[ 1 ]:End()
oFont[ 2 ]:End()
oFont[ 3 ]:End()
oFont[ 4 ]:End()
RETURN NIL
Regards, Saludos.
Dear Karinha,
it's not working.
I thought about it and compared Report class and rpreview code.
There are no major changes.
Why is it that FWH2212 to FWH2404 now has the same source code but cannot be exported to Excel?
Re: Report rpreview excel button disable not work
Posted:
Fri Apr 26, 2024 11:38 am
by karinha
Prueba este ejemplo, pls.
- Code: Select all Expand view
// C:\FWH\SAMPLES\TESTRPT2.PRG
// FiveWin own report engine sample
#include "Report.ch"
#include "FiveWin.ch"
STATIC oReport
//----------------------------------------------------------------------------//
Function Main()
LOCAL oFont1, oFont2, cAlias
SET _3DLOOK ON
DEFINE FONT oFont1 NAME "ARIAL" SIZE 0,-10
DEFINE FONT oFont2 NAME "ARIAL" SIZE 0,-10 BOLD
USE Customer
INDEX ON Customer->Last TO Customer
SET INDEX TO Customer
GO TOP
cAlias := ALIAS()
REPORT oReport ;
TITLE "*** LISTADO DE PRUEBA ***","",OemtoAnsi("FiveTech Software"),"" ;
FONT oFont1, oFont2 ;
HEADER "Fecha: "+dtoc(date()),"Hora: "+time() ;
FOOTER OemtoAnsi("P gina: ")+str(oReport:nPage,3) ;
PREVIEW // TO PRINTER
//GROUP ON Customer->State ;
// FOOTER "Total Estado "+oReport:aGroups[1]:cValue
COLUMN TITLE "ST" ;
DATA Customer->State
COLUMN TITLE "City" ;
DATA Customer->City
COLUMN TITLE "First Name","Last Name" ;
DATA Customer->First, Customer->Last
COLUMN TITLE " Salary" ;
DATA Customer->Salary ;
PICTURE "9,999,999" ;
SIZE 9 RIGHT ;
TOTAL
// Habilita Boton Excel en Preview
oReport:bInit := { || ( cAlias )->( DBGOTOP() ) }
END REPORT
ACTIVATE REPORT oReport // ON STARTPAGE Datos()
RETURN NIL
Function Datos()
local cText
cText := "Ancho hoja : "+str(oReport:nWidth)+CRLF
cText += "Ancho listado : "+str(oReport:nRptWidth)+CRLF
cText += "Margen Izquier: "+str(oReport:nLeftMargin)+CRLF
cText += "Margen Derecho: "+str(oReport:nRightMargin)+CRLF
cText += "Ancho del Font: "+str(oReport:aFont[1]:nWidth)+CRLF
cText += "Alto del Font: "+str(oReport:aFont[1]:nHeight)+CRLF
cText += "Ancho Standard: "+str(oReport:nSeparator)+CRLF
cText += "Ancho columna1: "+str(oReport:aColumns[1]:nWidth)+CRLF
cText += "Ancho columna2: "+str(oReport:aColumns[2]:nWidth)+CRLF
Alert(cText)
RETURN NIL
// FIN / END
Regards, saludos.
Re: Report rpreview excel button disable not work
Posted:
Fri Apr 26, 2024 11:53 am
by richard-service
karinha wrote:Prueba este ejemplo, pls.
- Code: Select all Expand view
// C:\FWH\SAMPLES\TESTRPT2.PRG
// FiveWin own report engine sample
#include "Report.ch"
#include "FiveWin.ch"
STATIC oReport
//----------------------------------------------------------------------------//
Function Main()
LOCAL oFont1, oFont2, cAlias
SET _3DLOOK ON
DEFINE FONT oFont1 NAME "ARIAL" SIZE 0,-10
DEFINE FONT oFont2 NAME "ARIAL" SIZE 0,-10 BOLD
USE Customer
INDEX ON Customer->Last TO Customer
SET INDEX TO Customer
GO TOP
cAlias := ALIAS()
REPORT oReport ;
TITLE "*** LISTADO DE PRUEBA ***","",OemtoAnsi("FiveTech Software"),"" ;
FONT oFont1, oFont2 ;
HEADER "Fecha: "+dtoc(date()),"Hora: "+time() ;
FOOTER OemtoAnsi("P gina: ")+str(oReport:nPage,3) ;
PREVIEW // TO PRINTER
//GROUP ON Customer->State ;
// FOOTER "Total Estado "+oReport:aGroups[1]:cValue
COLUMN TITLE "ST" ;
DATA Customer->State
COLUMN TITLE "City" ;
DATA Customer->City
COLUMN TITLE "First Name","Last Name" ;
DATA Customer->First, Customer->Last
COLUMN TITLE " Salary" ;
DATA Customer->Salary ;
PICTURE "9,999,999" ;
SIZE 9 RIGHT ;
TOTAL
// Habilita Boton Excel en Preview
oReport:bInit := { || ( cAlias )->( DBGOTOP() ) }
END REPORT
ACTIVATE REPORT oReport // ON STARTPAGE Datos()
RETURN NIL
Function Datos()
local cText
cText := "Ancho hoja : "+str(oReport:nWidth)+CRLF
cText += "Ancho listado : "+str(oReport:nRptWidth)+CRLF
cText += "Margen Izquier: "+str(oReport:nLeftMargin)+CRLF
cText += "Margen Derecho: "+str(oReport:nRightMargin)+CRLF
cText += "Ancho del Font: "+str(oReport:aFont[1]:nWidth)+CRLF
cText += "Alto del Font: "+str(oReport:aFont[1]:nHeight)+CRLF
cText += "Ancho Standard: "+str(oReport:nSeparator)+CRLF
cText += "Ancho columna1: "+str(oReport:aColumns[1]:nWidth)+CRLF
cText += "Ancho columna2: "+str(oReport:aColumns[2]:nWidth)+CRLF
Alert(cText)
RETURN NIL
// FIN / END
Regards, Saludos.
Dear Karinha,
Test testrpt2/testrpt3/testrpt4/testrpt5 and report.prg
Export Excel button disable.
Re: Report rpreview excel button disable not work
Posted:
Fri Apr 26, 2024 4:47 pm
by richard-service
karinha wrote:You put:
Tú colocaste:
- Code: Select all Expand view
LOCAL cAlias
USE...
cAlias := ALIAS()
// Habilita Boton Excel en Preview
oReport:bInit := { || ( cAlias )->( DBGOTOP() ) }
Regards, Saludos.
I build fwh\samples\report.prg not working.
- Code: Select all Expand view
// Testing FiveWin built-in report engine and print preview
#include "FiveWin.ch"
#include "Report.ch"
static oWnd, lPreview := .F.
function Main()
local oBar, oCursorHand
DEFINE WINDOW oWnd ;
TITLE "Testing FiveWin Report-Engine and Print-Preview" ;
MENU BuildMenu()
DEFINE BUTTONBAR oBar _3D SIZE 26, 27 OF oWnd
DEFINE BUTTON OF oBar FLAT TOOLTIP "Generate report" ;
ACTION DoReport() RESOURCE "Report"
DEFINE BUTTON OF oBar FLAT GROUP TOOLTIP "Exit" ;
ACTION oWnd:End() RESOURCE "Exit"
DEFINE CURSOR oCursorHand HAND
AEval( oBar:aControls, { | o | o:oCursor := oCursorHand } )
DEFINE MESSAGE BAR OF oWnd TITLE FWCOPYRIGHT ;
NOINSET DATE CLOCK KEYBOARD
ACTIVATE WINDOW oWnd ;
VALID ! lPreview .and. MsgYesNo( "Want to exit ?" )
return nil
function BuildMenu()
local oMenu
MENU oMenu
MENUITEM "&Generate Report" ACTION DoReport() ;
MESSAGE "Open customers database and generate a report"
MENUITEM "&Exit" ACTION oWnd:End() ;
MESSAGE "Terminate the application and exit"
ENDMENU
return oMenu
function DoReport()
local oRpt
lPreview = .T.
USE Customer
GO TOP
REPORT oRpt PREVIEW
COLUMN TITLE "First" DATA Customer->First
COLUMN TITLE "Last" DATA Customer->Last
COLUMN TITLE "State" DATA Customer->State
END REPORT
// Habilita Boton Excel en Preview
oRpt:bInit := { || Customer->( DbGoTop() ) }
oRpt:bSkip := { || Customer->( DbSkip() ) }
ACTIVATE REPORT oRpt WHILE !Customer->(Eof())
USE
lPreview = .F.
return nil
Re: Report rpreview excel button disable not work
Posted:
Fri Apr 26, 2024 5:19 pm
by karinha
Get in touch with the FiveTech team, I think someone committed an atrocity in the RPREVIEW.PRG class of the version you use.
Ponte en contacto con el equipo de FiveTech, creo que alguien cometió una atrocidad en la clase RPREVIEW.PRG de la versión que utilizas.
Tks.
Regards, saludos.
Re: Report rpreview excel button disable not work
Posted:
Sat Apr 27, 2024 4:50 am
by nageswaragunupudi
Please try this change in \source\classes\report.prg :
Please locate these lines towards the end of METHOD Activate( .......... ) CLASS TReport
- Code: Select all Expand view
if !::lHaru .and. Empty( ::oDevice:cFile ) .and. !PrintQueue()
PrintEnd()
// Eval( ::bPreview, ::oDevice )
else
Please modify as:
- Code: Select all Expand view
if !::lHaru .and. Empty( ::oDevice:cFile ) .and. !PrintQueue()
// PrintEnd()
Eval( ::bPreview, ::oDevice )
else
Please test with this change and provide your feedback
Re: Report rpreview excel button disable not work
Posted:
Sat Apr 27, 2024 5:48 am
by richard-service
nageswaragunupudi wrote:Please try this change in \source\classes\report.prg :
Please locate these lines towards the end of METHOD Activate( .......... ) CLASS TReport
- Code: Select all Expand view
if !::lHaru .and. Empty( ::oDevice:cFile ) .and. !PrintQueue()
PrintEnd()
// Eval( ::bPreview, ::oDevice )
else
Please modify as:
- Code: Select all Expand view
if !::lHaru .and. Empty( ::oDevice:cFile ) .and. !PrintQueue()
// PrintEnd()
Eval( ::bPreview, ::oDevice )
else
Please test with this change and provide your feedback
Dear Rao,
Now, it's working.
I back to find fwh2212 report.prg code below:
- Code: Select all Expand view
if !::lHaru .and. Empty( ::oDevice:cFile )
Eval( ::bPreview, ::oDevice )
else
PrintEnd()
endif