Delivering Reports Using the Report Viewer

In the previous section, only printing and exporting were mentioned as options for delivering reports. You might have been wondering how to view reports onscreen. This section will cover using the report viewer to view reports. This report viewer control is usually referred to as the ActiveX viewer, or the Crystal Reports Viewer Control. It is an ActiveX control, which means that in addition to being able to be dropped on to any Visual Basic formlike the other components of the Report Designer Componentit can be used in any COM-compliant development environment. Its filename is CRViewer.dll. Figure 30.4 depicts the ActiveX viewer displaying a report from a Visual Basic application.

Figure 30.4. A Crystal Report is shown here being displayed in the ActiveX viewer.

graphics/30fig04.jpg


The ActiveX viewer works in conjunction with the object model and report engine to render the report to the screen. The object model talks to the report engine to process the report, and then the ActiveX viewer asks the object model for the data for an individual page. After this data is received by the viewer, it displays the report page onscreen. The following code snippet illustrates how to view a report with the report viewer control:






Dim Application As New CRAXDRT.Application

Dim Report As CRAXDRT.Report



Set Report = Application.OpenReport("C:MyReport.rpt")

CRViewer.ReportSource = Report

CRViewer.ViewReport


The ActiveX control has many properties and methods that enable you to customize its look and feel. To turn off the toolbar at the top of the viewer control, simply set the DisplayToolbar property to false. To turn off the group tree, set the DisplayGroupTree property to false. This can result in a very minimalist viewer. In addition, the control has a full event model that notifies you when certain actions are performed, such as a drill-down or page navigation. For more information on the ActiveX viewer control, consult the Crystal Reports 10 developer help file.






Special Edition Using Crystal Reports 10
Special Edition Using Crystal Reports 10
ISBN: 0789731134
EAN: 2147483647
Year: 2003
Pages: 341
Simiral book on Amazon

Flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net