Megosztás a következőn keresztül:


Report Overview (Visual Studio)

This topic provides a concise summary of the kinds of reports you can create, the composition of a report, report features, and a description of a report definition.

Kinds of Reports

Using the report template and design support that is provided with client report definition (.rdlc) files, you can build the following kinds of reports for ReportViewer controls:

  • Freeform reports are composed of text boxes, data regions, images, and other report items. When you build free-form reports, you should use lists and rectangles to keep items together. You can use nested data regions and embedded subreports to encapsulate data in the report.

  • Multicolumn reports present data in contiguous columns where data flows down from one column to the next, similar to a newspaper format. For more information, see Report Properties - Layout Tab (Visual Studio Report Designer).

  • Drillthrough reports provide data exploration through links to supporting information. Drillthrough actions that you add to a report provide the navigation path to related reports.

  • Interactive reports include links, bookmarks, document maps, and show / hide functionality that allows you to create toggle items to reveal or hide parts of a report. You can create drilldown reports using visibility and toggle properties. Drilldown reports contain summarized data that users can expand to view supporting detail within the main report.

  • Simple reports might include a single table or chart. You might create multiple simple reports and then combine them onto a single form or Web page for a dashboard effect.

Only one template is provided. However, most reports that you are likely to build and use can be created from the base template.

Parts of Reports

The report Toolbox provides the building blocks for designing a client report definition (.rdlc) file in a visual environment. The following items can be used in a report.

  • Text box is used to display single instance data. Text boxes can be placed anywhere on a report and can contain labels, fields, or calculated data. You use expressions to define data in text boxes. For information about adding a text box to a report using Report Designer, see Adding a Text Box.

  • Table is a data region that you use to create tabular reports or to add table structures to a report. For more information, see Adding a Table.

  • Matrix is a data region that arranges data into columns and rows that intersect at specific data points. Matrices provide functionality similar to crosstabs and pivot tables. Unlike a table, which has a static set of columns, matrix columns can be dynamic. You can define matrices that contain static and dynamic rows and columns. For more information, see Adding a Matrix.

  • Chart is a data region that you use to create visual data. You can create a variety of chart types. For more information, see Adding a Chart.

  • Image is used to display binary image data in a report. You can use external, embedded, or database images in .bmp, .jpeg, .gif, and .png formats. For information, see Adding an Image.

  • Subreport is used to embed one report within another. It can be a full report that runs on its own, or it can be a report that looks best when embedded within the main report. When you define a subreport, you can also define parameters to filter data in the subreport. For more information, see Adding a Subreport.

  • List is a data region that you use to display repeating rows data for a single field, or to contain other report items. For more information, see Adding a List.

  • Rectangle is used as a graphical element or as a container for other report items. When you place report items within a rectangle, you can move them with the rectangle. For more information, see Adding Rectangles, Lines, and Borders to a Report.

  • Line is a graphical element that you can place anywhere on a page. It has no data associated with it. For more information, see Adding Rectangles, Lines, and Borders to a Report.

All items in a report, including data groups, table and matrix columns and rows, report items, and the report itself, have associated properties. These properties govern the appearance and behavior of the item.

Reporting Features

Reports that are used with the ReportViewer controls support the following functionality:

  • Expressions for calculating and aggregating data, and/or to support conditional formatting.

  • Actions to support links, bookmarks, and document maps in HTML reports.

  • Parameters, filters, sorting, and grouping functionality so that you can retrieve and organize the data with precision.

  • Support for adding custom code assemblies so that you can provide dynamic functionality or special features in a report.

  • Run-time functionality so that users can navigate a large report, search for specific data, export the report to a file, print the report, and more.

Sources of Reports

At run time, ReportViewer controls can be used with reports that originate from the following sources:

  • Client report definition (.rdlc) files that are opened from the file system and processed locally. These reports always use Visual Studio data sources.

  • Server reports that are published on a SQL Server Reporting Services report server. Server reports can be run on demand, run as a report snapshot, or run from cache.

A single application can include locally and remotely processed reports for both Web pages and Microsoft Windows Forms. Output for the report is consistent with the control type (HTML for the Web server control; GDI for the Windows Forms control).

For more information client and server reports, see Configuring ReportViewer for Remote Processing and Configuring and Using the ReportViewer Toolbar.

About Report Definition Files

Reports are based on a report definition, an XML file that describes data and layout. Visual Studio creates the report definition for you when you add a report item to a project and define the report layout. The file extension for a report definition that is processed locally is .rdlc. The file extension for a report definition that is published to report server is .rdl. Both report definition file types are written in Report Definition Language (RDL), an XML language that is documented in SQL Server 2005 Books Online.

When report execution is triggered (for example, you provide a button that the user clicks to view a report), the ReportViewer control retrieves data using the data bindings you have defined and merges the result set into the report layout. The report is presented in the native output format for the control you are using. For the Web server control, the output format is HTML. For the Windows Forms control, the output format is Graphical Device Instrumentation (GDI) format.

Reports that are based on .rdlc files are very similar to report definition (.rdl) files created for SQL Server 2005 Reporting Services. Although the XML schema is identical for both report definitions, each file type has different validation rules. An .rdl must include a query to be considered valid. An .rdlc is valid even though it is missing query information. If an .rdlc does contain a query, the query is ignored. If an .rdlc contains custom report item elements, those elements are also ignored (custom report items are only supported in .rdl).

See Also

Concepts

Using Expressions in a Report (Visual Studio Report Designer)
ReportViewer Web Server and Windows Forms Controls
Creating Client Report Definition (.rdlc) Files
Adding Custom Code to a Report (Visual Studio Report Designer)
Creating Data Sources for a Report

Other Resources

Samples and Walkthroughs