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

Post Reply
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

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

Post by dutch »

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 19.01 / 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)
User avatar
fgondi
Posts: 636
Joined: Fri Oct 07, 2005 6:58 am
Location: Palencia, España
Contact:

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

Post by fgondi »

I use Crystal report 2013 with ADS

Code: Select all

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 GHE Sistemas Informáticos
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

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

Post by dutch »

Dear Fernando

Thank you so much. I will study from your sample.
Regards,
Dutch

FWH 19.01 / 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)
Post Reply