This article describes the structure of a Telerik Report.
The design of a report is divided into sections and you can open your report in Visual Studio Report Designer or Standalone 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.
A report can be either data bound or unbound. To create a bound report you should first bind the report or a nested Data Item 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.
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 ).
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):
This section is printed at the top of every page. For example, you can 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, which has the following implications:
Table of Contents
This section provides a set of navigational links to report items in the report and displays their corresponding page numbers. The user can click the entries in the table of contents to navigate to the report page which displays that item. The table of contents section can be displayed before or after the Report Header/Report Footer section based on the user preferences. For more information see Table of Contents.
This 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.
This 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.
This 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.
This 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.
This 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.
This section is printed at the end of every page. Use a page footer to print page numbers or per-page information. This section and its items are processed by the corresponding rendering extension after the report data has been processed. Therefore, the same implications listed for the Page Header section apply to the Page Footer section as well.
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 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).