Let us first begin by discussing report files. Each
reporting package handles the report files slightly differently, but underlying
concepts are the same. With Crystal Reports, the report files are .RPT files.
The .RPT files are created using the Crystal Reports Designer, which is
available as a stand-alone program, or an add-in to Visual Studio. Many
versions of Visual Studio ship with a version of the Crystal Reports designer
add-in, meaning you can create Crystal Reports within Visual Studio without
having to buy additional software or licenses. The Crystal Reports Designer
add-In for Visual Studio is a good tool, but the stand-alone Crystal Reports
designer has additional features that make report creation much easier.
Examples in this article will use the stand-alone Crystal Reports designer, but
all of the features discussed are available in the Visual Studio add-in as
well.
A basic Crystal Report file is divided into five sections.
Report Header
The Report Header is only rendered once per report, on the
top of the report. It is common for developers to place information such as
company logos and filter criteria specific to the report in this section.
Page Header
The Page Header is rendered on the top of each page of the
report. On the very first page of the report, the Page Header is rendered under
the Report Header. It is common for developers to place field names of the
columns that are rendered on the report in this section.
Details
The details section of a report is where the magic happens.
An instance of the details section is rendered for each record in the data set
that was passed to the Crystal Report file. Developers place the columns of
data that needs to be presented on the report in this section.
Report Footer
The Report Footer displays only once on the last page of the
report.
Page Footer
The Page Footer is rendered at the bottom of each page of
the report. In this section it is common to see developers place page numbers
and the date/time that the report was printed.
Figure 1: Report Sections