Implementing the Page Viewer

The first viewer component to be covered is the Page viewer, as illustrated in Listing 32.5. To use this viewer, you will create its CrystalReportViewer object. It, along with all the other viewers, exposes a method called setReportSource that accepts a valid report source object as obtained from the description in the previous section. Finally, again like the other viewers, it has a processHttpRequest method that accepts references to the current servlet context. This method does the actual rendering to HTML.

Listing 32.5. Viewing a Report over the Web

//To create a Java report viewer you need to instantiate a CrystalReportViewer

//object. To create a CrystalReportViewer object:

CrystalReportPartsViewer viewer = new CrystalReportViewer();



//Obtain a ReportSource object. Set the viewers report source by calling its

//setReportSource method.

viewer.setReportSource(reportSource);



//When you have created and initialized a Java report page viewer, you call

//its processHttpRequest method to launch it in a Web //browser.

viewer.processHttpRequest(request, response, getServletContext(), null);


Figure 32.1 shows the output of this code.

Figure 32.1. A report being displayed in an HTML page viewer.

graphics/32fig01.gif


All viewers including the Page viewer share a number of toolbar elements. These properties can be programmatically toggled and are displayed in Table 32.1. All the viewer properties must be set before calling the ProcessHTTPRequest method that displays the selected report. For example, to ensure the Crystal logo is displayed when the involved report is viewed, the code line






Viewer.HasLogo(true);


Table 32.1. Toolbar Elements (Page Viewer)

Property

Property Description

HasLogo

Includes or excludes the "Powered by Crystal" logo when rendering the report.

HasExportButton

Includes or excludes the export button when rendering the report.

HasGotoPageButton

Includes or excludes the Go to Page button when rendering the report.

HasPageNavigationButtons

Includes or excludes the page navigation buttons when rendering the report.

HasPrintButton

Includes or excludes the Print button when rendering the report.

HasRefreshButton

Includes or excludes the Refresh button when rendering the report.

HasSearchButton

Includes or excludes the Search button when rendering the report.

HasToggleGroupTreeButton

Includes or excludes the Group Tree toggle button when rendering the report.

HasViewList

Specifies whether the viewer should display a list of previous views of the report.

SetPrintMode

Set printing to use PDF or Active X printing (0=pdf, 1=actx).

HasZoomFactorList

Specifies zoom factor for displayed report.


needs to be included in the code before the processHTTPRequest method is called.

As the different viewers are introduced and discussed later in this chapter, some additional elements pertinent to the viewer being discussed will be displayed in that sections table.


Part I. Crystal Reports Design

Creating and Designing Basic Reports

Selecting and Grouping Data

Filtering, Sorting, and Summarizing Data

Understanding and Implementing Formulas

Implementing Parameters for Dynamic Reporting

Part II. Formatting Crystal Reports

Fundamentals of Report Formatting

Working with Report Sections

Visualizing Your Data with Charts and Maps

Custom Formatting Techniques

Part III. Advanced Crystal Reports Design

Using Cross-Tabs for Summarized Reporting

Using Record Selections and Alerts for Interactive Reporting

Using Subreports and Multi-Pass Reporting

Using Formulas and Custom Functions

Designing Effective Report Templates

Additional Data Sources for Crystal Reports

Multidimensional Reporting Against OLAP Data with Crystal Reports

Part IV. Enterprise Report Design Analytic, Web-based, and Excel Report Design

Introduction to Crystal Repository

Crystal Reports Semantic Layer Business Views

Creating Crystal Analysis Reports

Advanced Crystal Analysis Report Design

Ad-Hoc Application and Excel Plug-in for Ad-Hoc and Analytic Reporting

Part V. Web Report Distribution Using Crystal Enterprise

Introduction to Crystal Enterprise

Using Crystal Enterprise with Web Desktop

Crystal Enterprise Architecture

Planning Considerations When Deploying Crystal Enterprise

Deploying Crystal Enterprise in a Complex Network Environment

Administering and Configuring Crystal Enterprise

Part VI. Customized Report Distribution Using Crystal Reports Components

Java Reporting Components

Crystal Reports .NET Components

COM Reporting Components

Part VII. Customized Report Distribution Using Crystal Enterprise Embedded Edition

Introduction to Crystal Enterprise Embedded Edition

Crystal Enterprise Viewing Reports

Crystal Enterprise Embedded Report Modification and Creation

Part VIII. Customized Report Distribution Using Crystal Enterprise Professional

Introduction to the Crystal Enterprise Professional Object Model

Creating Enterprise Reports Applications with Crystal Enterprise Part I

Creating Enterprise Reporting Applications with Crystal Enterprise Part II

Appendix A. Using Sql Queries In Crystal Reports

Creating Enterprise Reporting Applications with Crystal Enterprise Part II



Special Edition Using Crystal Reports 10
Special Edition Using Crystal Reports 10
ISBN: 0789731134
EAN: 2147483647
Year: 2003
Pages: 341

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