Reporting

This article describes the structure of a Telerik Report. To learn more about the report building blocks used in Telerik Report, refer to Understanding Report Sections (obsolete) and Understanding Report Items (obsolete).

Report Structure

Telerik Reporting is an embedded engine, thus available and accessible directly within your application. Telerik Reports are standard .NET classes and you can add a report to a project and handle it in the Visual Studio IDE in a similar manner to what you're already used to.

A Telerik Report is represented by an instance of the Report class and each report serves as a container for sections. In the same way every section serves as a container for report items.

The design of a report is divided into sections and you can open your report in Visual Studio Report Designer to see its sections. To create useful reports, you need to understand how each section works. For example, the section in which you choose to place a data bound items determines how Telerik Reporting calculates the results.

Report sections divide the report vertically. Depending on their type they appear on specific places in the report document and the report items they contain are processed and rendered differently. For more information see Understanding Report Sections (obsolete)

A report can be either data bound or unbound. To create a bound report you should first bind the report or a nested Data Items to a data source, and then specify Expressions for report items within the report or data item. To learn more about creating a bound report, see the Connecting to Data and Using Expressions sections.

After a report is constructed, it is possible to save it to XML file and re-use it later (for more information, see Serializing Report Definition in XML). Also, if a report uses stylesheets, they can be saved to xml file and shared between multiple reports in your application (for more information, see Exporting and Reusing Style Sheets ).

Report Sections

Telerik Report consists of a number of sections, each of a different type. Every section may contain report items. A report section represents a specific area on a report page, used to define how to render report items that belong to it. Every section is an instance of the ReportSectionBase class. The Height property defines the space that a section occupies on a page. Other specific properties such as PrintOnFirstPage and PrintOnLastPage define a section's behavior.

When a new Telerik Report is added to a project, it is initially divided into three sections - PageHeader, Detail and PageFooter. A section type specifies how the items located on this section are rendered, their rendering order and how many times they are rendered if report is data bound.

The following table presents a summary of the section types and their usage (in order of appearance in the report document):

Section TypeDescription
Page HeaderThis section is printed at the top of every page. For example, use the page header to repeat the report title on every page. Since the paging of a report strongly depends on the format it is rendered to, this section and its items are processed by the corresponding rendering extension after the report data has been processed. At this moment the report data source is not available anymore and due to this you can use the built-in PageNumber and PageCount objects (which contain the current page number and the total report pages count) only in this section. It is possible to suppress the printing of the Page Header section on the first and last page of a report, but the space taken up would always be reserved no matter whether it is visible.
Report HeaderThis section is printed just once, at the beginning of the report. Use the report header for information that might normally appear on a cover page, such as a logo, a title, or a date. In the Report Header section all data fields must be aggregated, even if the data source returns only one row. Typically you should use the FIRST() function for character and date data and the SUM() function for numeric data. When you place a databound report item that uses an aggregate function in the report header, it is calculated for the entire report data.
Group HeaderThis section is printed at the beginning of each new group of records. Use the group header to print the group name. For example, in a report that is grouped by product, use the group header to print the product name. In the Group Header section all data fields must be aggregated, even if the data source returns only one row. Typically you should use the FIRST() function for character and date data and SUM() function for numeric data. When you place a databound report item that uses an aggregate function in the Group Header, it is calculated for the entire group data.
DetailThis section is printed once for every row in the data source. This is where you place the report items that make up the main body of the report.
Group FooterThis section is printed at the end of each group of records. Use a group footer to print summary information for a group. Similar to the Group Header section, you should always use aggregate functions for the databound items that are calculated for the group data.
Report FooterThis section is printed just once, at the end of the report. Use the report footer to print report totals or other summary information for the entire report. Similar to the Report Header section, you should always use aggregate functions for the databound items that are calculated for the entire report data.
Page FooterThis section is printed at the end of every page. Use a page footer to print page numbers or per-page information. Similar to the Page Header Section you cannot use databound items, but can access the PageNumber and PageCount objects. It is possible to suppress the printing of the Page Footer section on the first and last page of a report, but the space taken up would always be reserved no matter whether it is visible.

Report Groups

Report Groups allow you to separate groups of data visually and to display introductory and summary data for each group. Report groups provide logical sections of data within the report while the group header and footer sections provide visual representation of the group boundaries. For example, you can group sales by date shipped and calculate the total amount of sales for each day.

You usually use a group header to display data that identifies the group in a separate section at the beginning of the group. You usually use a group footer to summarize the data in the group in a separate section at the end of the group.

The data within the report can be grouped by fields and expressions. Report groups are defined by adding Group objects to the report’s Groups collection. Report groups are always nested according to the order in the Groups collection. To display group data one should use the GroupHeaderSection and GroupFooterSection that appear once for each group member, respectively at start and end. The DetailSection displays detail data in a report and always appears inside the innermost group (if any).

Report Items

Report items are inserted into a report depending on what you need e.g. TextBox item for static or data bound text, PictureBox for displaying images, Barcode for showing barcode in your label report etc. Every report item is an instance of the ReportItemBase class. Report items can reside either inside report sections or inside other report items that may serve as item containers (e.g. Panel or Table/Crosstab/List items).

The appearance and behavior of a report item is defined by its type. See Understanding Report Items (obsolete) section for more info about different report item types available in the current version of Telerik Reporting.

See Also