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 more functional reports, you need to understand how each section works. For example, the section in which you choose to place a data bound item determines how Telerik Reporting calculates the results.
Report sections divide the report vertically. Depending on their type (e.g. Page sections, Group sections, etc.) they appear on specific places in the report document and the report items they contain are processed and rendered differently.
A report can be bound to data. To create a data bound report you need to assign the Report or its nested Data Item a data source. Then you should specify Expressions for the items within the report or corresponding data item where to display the actual data. To learn more about creating a data bound report, see the Connecting to Data and Using Expressions sections.
The styling of the report items may be reused in stylesheets. 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).
The Telerik Report consists of several different sections that may contain report items. Each report section represents specific area on the report page, and defines how to render the 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 the page. Other specific properties such as PrintOnFirstPage and PrintOnLastPage define the particular section's behavior.
When a new Telerik Report is added to a project, it is initially divided into three sections - PageHeader, Detail and PageFooter. The section type specifies how the items inside will be rendered, their rendering order and how many times they will be rendered when the report is data bound.
The following table presents a summary of the section types and their usage (in the default order of appearance in the report document):
|Page Header||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 (TOC)||This section provides a set of navigational links to report items and displays the page numbers where they can be found. The user can click the entries in the table of contents to navigate to the report page which displays that item. The TOC 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.|
|Report Header||This section is printed just once, at the beginning of the report. If there is Page Header on the first page, the Report Header will be rendered after it. If there is TOC section, you may specify its position with respect to Report Header (e.g. Before or After). 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 Header||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.|
|Detail||This section is printed once for every row in the data source. This is where you place the report items that constitute the main body of the report. The detailed information will be displayed in this section.|
|Group Footer||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.|
|Report Footer||This section is printed just once, at the end of the report. If there is Page Footer on the last page, the Report Footer will be rendered before it. If there is TOC section, you may specify its position with respect to Report Footer (e.g. Before or After). 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 Footer||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 apply also to the Page Footer section.It is possible to hide this section for particular pages using Conditional Formatting expression over the Style.Visible property. For example, you may hide it on all even pages. To hide it on first and/or last pages there are dedicated Boolean properties called PrintOnFirstPage and PrintOnLastPage. Hiding the section leads to freeing page space for the rest of the report content. Keep in mind that setting the PrintOnLastPage to true may lead to unintuitive pagination of the section preceding the last PageFooter. This occurs because determining the last page number and hiding the last PageFooter are interdependent when the last non-PageFooter section would fit in the space regularly occupied from the PageFooter. For example, this may be observed when replacing the last PageFooter section with a ReportFooter section.|
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.
Usually, the data that identifies the group will be displayed in a separate section at the beginning of the group, e.g. a group header. The group footer is generally used to summarize the group data 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 summary group data one should use the GroupHeaderSection and GroupFooterSection that appear once for each group member at the beginning and the end, respectively. The DetailSection displays report detail data and always appears inside the innermost group.
Report items are used in the report depending on the data that should be displayed e.g. TextBox item for static or data bound text, PictureBox for displaying images, Barcode for showing barcode in a label report etc. Every report item is an instance of the ReportItemBase class. Report items can reside inside report sections or containers (e.g. Panel or Table/Crosstab/List items).