Are you looking at the tutorial on how to integrate crystal reports in Delphi 7? Here‘ a blog post that explains with step by step instructions on how you can do it.
How to use crystal reports in Delphi 7?
To include the RDC runtime library into Delphi, start a new project in Delphi and follow these steps:
1. Select the Project menu and then the Import Type Library.
2. In the Import Type Library, Select Crystal Report x ActiveX Designer Runtime Library and rename the TReport and TDatabase class names to CRReport and TCRDatabase to avoid the naming conflicts
3. Click the Install button, click the Into New Package tab, provide a file name path for the new package, and select ok.
4. In the Confirm box, click Yes On Delphi’s ActiveX tab. There is now an Application object icon and CRReport object icon.
5. From Delphi’s ActiveX tab, place an Application object onto Form1. This adds OleServer and CRAXDRT_TLB to the Uses clause on Form1.
To work with RDC , we now require Report Object and the Application Object
1. Declare the report object and the Application Object
report : IReport;
2. Open the report using the Application’s OpenReport function
report := Application1.OpenReport(‘c:\senthilreport.rpt’,crOpenReportByTempCopy);
The first parameter to the OpenReport function is the path of the report file .The second parameter’s description is as follows
1. The CrOpenReportByDefault locks the RPT file preventing it from being accessed by other users.
2. CrOpenReportByTempCopy opens a temporary copy of the RPT file.
Next we need to Add the Crystal Report Viewer Control to access the data in the Report .
To include the CRViewer into your project:
1. Select the Project menu and Import Type Library.
2. Select Crystal Reports Viewer Control and click the Install button. The CRViewer control is added to Delphi’s ActiveX tab.
3. Add the CRViewer control to Form1.
Set the ReportSource to the report created using the OpenReport function .
crViewer1.ReportSource := report; crViewer1.ViewReport;
You should see the Crystal Report viewer with the Data once you run the Project .