Working with Areas and Sections

Another often-used class is the ReportDefinition class, which is used to retrieve all of the areas, sections, and report objects shown in your report. An area within the context of a Crystal Report corresponds to the types of sections we talked about earlier in Chapter 2, "Getting Started with Crystal Reports .NET." There are seven different types of areas, including:

Detail

GroupFooter

GroupHeader

PageFooter

PageHeader

ReportFooter

ReportHeader

You may remember from Chapter 2 that all of these different types of areas can also have multiple sections within them (Details A, Details B, and so on), as shown in Figure 9-7:

All of the areas within your report are held within the Areas collection of the ReportDefinition, which can be accessed through the name of the area or by the number. For example, if you wanted to work with the report header area, you could access it using:

myReport.ReportDefinition.Areas("ReportHeader")

Likewise, you could access it using its item number as well:

myReport.ReportDefinition.Areas(l)

Figure 9-7

So, to start looking at how we can control these areas and sections at run time, we will take a look at areas first.

Formatting Areas

To get a feel for some of the formatting options that are available for sections, as shown in Figure 9-8, open the employee_listing report in the Report Designer, right-click a section heading, and select Format Section...:

Most of the formatting options shown in this dialog can be directly read or set using the properties associated with the AreaFormat class, including:

Property

Description

Was this article helpful?

0 0

Post a comment