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

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

Postby dutch » 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 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
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

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

Postby fgondi » Thu Jun 23, 2016 3:08 pm

I use Crystal report 2013 with ADS

Code: Select all  Expand view
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
User avatar
fgondi
 
Posts: 694
Joined: Fri Oct 07, 2005 6:58 am
Location: Palencia, España

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

Postby dutch » Thu Jun 23, 2016 10:05 pm

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)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 26 guests