Page 1 of 1

Crystal Report

Posted: Fri Oct 04, 2013 2:19 am
by Andy Edward
Hi,

Anyone can point me to a tutorial of using crystal report with xbase??

I've searched in google and found FRAX, but quite worried that the product might not be supported anymore.

Regards,

Andy

Re: Crystal Report

Posted: Mon Jan 12, 2015 1:31 pm
by DDunlap
I have client that has and is using crystal reports to create their own special reports. it works .

Re: Crystal Report

Posted: Tue Jan 13, 2015 8:15 pm
by pedroah
You need Crystal Reports Runtime files 11.5 version, this is the last version that supports ActiveX.

This link is a Dropbox, have the Runtime installer and some books.
https://www.dropbox.com/sh/avbnoznroebw ... QLrRa?dl=0

Sample code :

Code: Select all


#include "Gra.ch"
#include "Xbp.ch"
#include "Common.ch"
#include "Appevent.ch"
#include "Font.ch"
#include "activex.ch"

#define crOpenReportByDefault    0
#define crOpenReportByTempCopy   1

PROCEDURE Main()
**   PrintCrReports("Test.rpt","Visualizador de Reportes ")
   PrintCrReports("Pruebaxml.rpt","XML")

RETURN

PROCEDURE PrintCrReports( cReport, cTitulo )
   LOCAL oDlg, oCrystal, oReport, oSec, oVor
   LOCAL oPara, oItemOne, oItemTwo, oItemThree, oTables
   LOCAL cPath := CurDrive() + ":\" + CurDir()
   LOCAL oDatabase
   LOCAL oSecItem

   IF !file( cReport )
      RETURN
   ENDIF

   oVor := NIL

   oDlg := xbpDialog():new(AppDesktop(),,{100,100},{800,600},,FALSE)
   oDlg:title                      := "CR-"+cTitulo
   oDlg:taskList                   := TRUE
   oDlg:clipChildren               := TRUE
   oDlg:drawingarea:clipChildren   := TRUE
   oDlg:drawingarea:resize         := {|aO,aN| oVor:setSize(aN) }
   oDlg:close := {|| BREAK( ) }
   oDlg:create( )

   //-------------------------------- C r y s t a l - A p p l i c a t i o n ----------------------
   // ALASKA: original was 8.5. This is removed, we get default version
   oCrystal := ActiveXObject():create( "CrystalRuntime.Application.11" )

   //-------------------------------- R e p o r t  -----------------------------------

   oReport := oCrystal:openReport(cReport,crOpenReportByTempCopy)

   //-------------------------------- D a t a b a s e ---------------------------------

   oDatabase := oReport:database
   oTables   := oDatabase:tables

   //? oTables:count
   //? oTables:item(1):location

   // ALASKA: work with absolute path!
   //oTables:item(1):location := "mmpatntx.dbf"
   oTables:item(1):location := "c:\SPOOLER\PRUEBA\producto.xml"
   //? oTables:item(1):location



   //---------------------------- S e l e c t  P r i n t e r ----------------------------

   //oReport:PrinterSetup(0)

   //-------------------------------- V i e w e r  -----------------------------------

   oVor := XbpActiveXControl():new( oDlg:drawingArea,, {0,0}, oDlg:drawingArea:currentSize() )

   oVor:clsid   := "CrystalReports115.ActiveXReportViewer.1"
   //oVor:clsid := "CRViewer.CRViewer"
   //oVor:clsid := "CRViewer.CRViewer.8.0"               && Alternativa
   //oVor:clsid := "CrystalReports.ActiveXReportViewer"  && Alternativa
   oVor:create()

   oVor:reportSource := oReport

   // Activar Botones
   oVor:EnableZoomControl         := TRUE
   oVor:EnableExportButton        := TRUE
   oVor:EnableStopButton          := TRUE
   oVor:EnableProgressControl     := TRUE
   oVor:EnableSearchExpertButton  := TRUE
   oVor:EnableDrillDown           := TRUE
   oVor:EnableCloseButton         := TRUE
   oVor:EnableProgressControl     := TRUE
   oVor:EnableSelectExpertButton  := TRUE

   oVor:viewReport()
   oDlg:show()

   BEGIN SEQUENCE
      AppEventLoop()
   END SEQUENCE

   oVor:destroy()
   oReport:destroy()
   oCrystal:destroy()
   oDlg:destroy()

RETURN

PROCEDURE AppEventLoop( )
   LOCAL nEvent := xbeP_None, mp1, mp2, oXbp
   oXbp := mp1 := mp2 := NIL

   DO WHILE nEvent <> xbeP_Close
      nEvent := AppEvent( @mp1, @mp2, @oXbp )
      oXbp:handleEvent( nEvent, mp1, mp2 )
   ENDDO
RETURN

PROC appsys()
RETURN

Attach prg + dbf + crystal reports file ( for this you need the editor to modify )

I hope this help

Re: Crystal Report

Posted: Tue Jan 13, 2015 8:20 pm
by rdonnay
Nice!!

I didn't know that Crystal Reports had an ActiveX control.

Thanks for that contribution.

Re: Crystal Report

Posted: Sun Feb 15, 2015 11:31 pm
by Andy Edward
pedroah wrote:this is the last version that supports ActiveX.
So does this mean subsequent versions of CR will not have ActiveX support?

Best Regards,

Andy

Re: Crystal Report

Posted: Wed Feb 18, 2015 10:21 am
by pedroah
that's right