Creating and initializing a DHTML report page viewer

The DHTML report page viewer is an instance of the CrystalReportViewer class. This class has many methods that affect how reports are displayed in a web browser. Some of these methods must be called before the viewer can render a report.

To create and initialize a DHTML report page viewer
  1. Reference the required Java classes and packages.
  2. <%@ page import="com.crystaldecisions.report.web.viewer.CrystalReportViewer" %>

    <%@ page import="com.crystaldecisions.reports.reportengineinterface.JPEReportSourceFactory" %>

    <%@ page import="com.crystaldecisions.sdk.occa.report.reportsource.IReportSourceFactory2" %>

  3. Create a CrystalReportViewer object.
  4. CrystalReportViewer viewer = new CrystalReportViewer();

  5. Set the viewer's report source by calling its setReportSource method, passing it a reference to a report source object.
  6. The viewer has now been created and initialized.

    viewer.setReportSource(reportSource);

  7. If the page contains only the viewer, call its setOwnPage method and pass in true. This allows the viewer to automatically perform page configuration and enables the print and export buttons. If the page contains elements other than the viewer, the setOwnPage method must be called with false and you need to manually set the content-type.
  8. Note:    Setting setOwnPage to false disables exporting and printing.

    viewer.setOwnPage(true);

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 Crystal Reports for Rational Application Developer Java API Reference.



Business Objects
http://www.businessobjects.com/
Support services
http://www.businessobjects.com/services/support/