Crystal Report

This forum is for general support of Xbase++
Post Reply
Message
Author
Andy Edward
Posts: 103
Joined: Fri Sep 17, 2010 2:58 am

Crystal Report

#1 Post 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

DDunlap
Posts: 8
Joined: Mon Jan 12, 2015 12:56 pm

Re: Crystal Report

#2 Post by DDunlap »

I have client that has and is using crystal reports to create their own special reports. it works .

User avatar
pedroah
Posts: 28
Joined: Wed Nov 05, 2014 7:15 pm
Location: Dominican Republic
Contact:

Re: Crystal Report

#3 Post 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
Attachments
crystal test.zip
(4.1 KiB) Downloaded 803 times

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Crystal Report

#4 Post by rdonnay »

Nice!!

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

Thanks for that contribution.
The eXpress train is coming - and it has more cars.

Andy Edward
Posts: 103
Joined: Fri Sep 17, 2010 2:58 am

Re: Crystal Report

#5 Post 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

User avatar
pedroah
Posts: 28
Joined: Wed Nov 05, 2014 7:15 pm
Location: Dominican Republic
Contact:

Re: Crystal Report

#6 Post by pedroah »

that's right

Post Reply