Creating and initializing a Java viewer

The viewer is simply an instance of a CrystalReportViewer object. A CrystalReportViewer object has many set methods that affect how it displays reports in a web browser. Some of them need to be called before the viewer can render a report. When using the Java Reporting Component, you need to set the viewer's report source.

To create and initialize a Java viewer
  1. Instantiate a CrystalReportViewer object.

    CrystalReportViewer viewer = new CrystalReportViewer();

  2. Set the viewer's report source by calling its setReportSource method, passing it a reference to a report source object.

    The viewer has now been created and initialized.

    viewer.setReportSource(reportSource);

Note:    Once the viewer is created and initialized, you can set a variety of properties related to its display characteristics, database logon handling, and parameter prompting. For more information, see the CrystalReportViewer documentation in the Viewer Java API Reference.



Crystal Decisions
http://www.crystaldecisions.com/
Support services
http://support.crystaldecisions.com/