Customizing crystal report viewer

Crystal Report Viewers work as a container of a report and allow us to view a crystal report in Windows and Web applications. Crystal Reports for Visual Studio .NET provides two report viewers - Windows Forms Viewer and Web Forms Viewer. As you can guess from these names, Windows Forms Viewer control is used to view reports in Windows Forms applications and Web Forms Viewer is used to display reports in Web Forms applications.

To view a report in the viewer, you simply need to set the ReportSource property of the control. The ReportSource property can be either a full name of the report file, a strongly typed report, or a ReportDocument object.

Using the CrystalReportViewer class members, we can customize the behavior of the viewer such as disabling or enabling viewer toolbar buttons, adding custom zoom factor, or moving to different views of the report at run time.

Steps to customize CrystalReportViewer using designer

  • Please refer "A simple report" to create a simple crystal report
  • Now open a windows form. Now open Toolbar > expand Crystal reports tab > select CrystalReportViewer > drag and drop it into windows form.
  • Open Properties of CrystalReportViewer object. Set following properties to customise the viewer.
    • ShowCloseButton
    • ShowExportButton
    • ShowGotoPageButton
    • ShowGroupTreeButton
    • ShowPrintButton
    • ShowRefreshButton
    • ShowTextSearchButton
    • ShowZoomButton
    • DisplayGroupTree
  • Now build and run the application.
Customizing CrystalReportViewer through program:

Download video: Customize viewer