Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

15.02 The ReportDefinition Classes

Mapping the ReportDefinition Classes

The ReportDefinition class manages everything printed on a report. It has collection classes for storing each area, section, and object shown on the report. You can map out every detail about your report. Leaning how to map these collections teaches you how they are organized. This is necessary for learning how to modify the individual report objects.

Figure 15-2 shows the object model for the ReportDefinition classes. It uses three collections for managing the objects: Areas, Sections and ReportObjects. You can see that the class tree is only a couple levels deep and that each collection is similar to the others. This makes them easy to understand.





Figure 15-2. The ReportDefinition object model.

The Areas collection stores the Area object. This Area object has a property that lets you access its formatting properties. The Sections collection class stores the Section object. The ReportObjects collection manages the ReportObject object. It is the final object in the object model and it only has formatting properties.

Each of the collections can be referenced directly or through its parent collection. For example you can go directly to each report object via the ReportObjects collection. You can also reference each report object via the section it is in. Each Section object has a ReportObjects collection that references just the report objects that are within that section.

Mapping out the report objects consists of looping through each collection and printing out the properties of each object. To be concise, this code only prints a few properties for each object. If you want to modify the code to print more properties, you can look at the object model to see the names of the additional properties and add them.