FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How to call Crystal Report Runtime (DLL) inside FWH?
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM

How to call Crystal Report Runtime (DLL) inside FWH?

Posted: Thu Jun 23, 2016 12:50 AM

Dear All,

I would like to call Crystal Report Runtime inside FWH+MySql. Can anyone guide me and give a sample to call Crystal Report Runtime?

Thank you in advance.

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 694
Joined: Fri Oct 07, 2005 06:58 AM

Re: How to call Crystal Report Runtime (DLL) inside FWH?

Posted: Thu Jun 23, 2016 03:08 PM
I use Crystal report 2013 with ADS

Code (fw): Select all Collapse
oCRApp         := CreateObject("CrystalRuntime.Application.11") 
oCRReport     := oCRApp:OpenReport(cRpt)
oCRDatabase := oCRReport:Database
oCRTables     := oCRDatabase:Tables

oCRTable:= oCRDatabase:Tables(1)
oCRTable:ConnectionProperties:DeleteAll()

oCRDatabase:LogOnServer ('crdb_Ads', "BASE DE DATOS ADD",, cUsuario, cPassword )

For i:= 1 to oCRTables:Count()
  oCRTable:= oCRDatabase:Tables(i)
  oCRTable:SetLogOnInfo( "BASE DE DATOS ADD", , cUsuario, cPassword )
next
oCRReport:EnableParameterPrompting("False")
oCRReport:DiscardSavedData()

//Ejemplo de Parametros si hacen falta
oCRParameterField := oCRReport:ParameterFields
if oCRParameterField:Count() > 0
  oCRParameterField:GetItemByName('pFchIni'):AddCurrentValue( dFchIni )
  ...
endif


//Visor ActiveX
 DEFINE Window oVentHija MDICHILD Title cTitle
 oActiveX := TActiveX():New( oVentHija, "CrystalReports11.ActivexReportViewer.1" )  
 oVentHija:oClient := oActiveX
 oVentHija:cTitle( cTitle )
 oActivex:SetProp( "ReportSource", oCRReport )
 oActiveX:SetProp( "EnableStopButton",     1  )
 oActiveX:SetProp( "EnableAnimationCtrl",  0  )
 oActiveX:SetProp( "EnableCloseButton",    1  ) 
 oActiveX:SetProp( "EnableExportButton",   1  )
 oActiveX:SetProp( "EnablePopupMenu",      0  ) 
 oActiveX:SetProp( "EnableRefreshButton",  0  )
 oActiveX:bOnEvent = { | event, aParams | EventInfo( event, aParams, oCRReport, oActivex  ) } 

ACTIVATE WINDOW oVentHija;
 ON INIT ( oActiveX:Do( "Viewreport" ) );
 Valid ( oCRDatabase:LogOffServer ('crdb_Ads', "BASE DE DATOS ADD",, cUsuario, cPassWord ), oCRDatabase := NIL, oActiveX := NIL, oCRReport := NIL )


function EventInfo( event, aParams, oCRReport, oActivex )
   local cMsg := cValToChar( event ) //+ CRLF
return cMsg
Un saludo

Fernando González Diez

ALSIS Sistemas Informáticos
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM

Re: How to call Crystal Report Runtime (DLL) inside FWH?

Posted: Thu Jun 23, 2016 10:05 PM

Dear Fernando

Thank you so much. I will study from your sample.

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)

Continue the discussion