ReportManager and ReportSlot

To get started on creating and using the report generator in your applications you need to put the PerpetuumSoft.Reporting.Components.ReportManager component on the form. Sources of reports will be stored in this component. Each report is stored in a non-visual ReportSlot component . This component stores a report template, has methods used to run the components as well as edit and generate the reports.

The binding mechanism of a report template with data based on the ReportManager and the ReportSlot components. The ReportManager can bind data with several report templates. Every template is provided by the ReportSlots.Report component and can be stored in a file, an application code or any other source.

For example, the software package includes the UrlReportSlot type, which gets a report by URL address specified by the user. The users can implement their own classes inherited from the ReportSlot to store reports in a particular place for its application.

The ReportManager component provides the ability to manage a group of reports that use the same data source, regardless of templates location. The ReportManager also binds dependent templates of such relations as Report - MasterReport, Report-SubReports.

Data is set in the DataSources property of the ReportManager. It contains collections of data sources. The source object and its name are set for each data source; and it can be any object (ADO.NET, business object). 

The ReportManager can also get data through the ResolveDataSource event.

Templates are set in the ReportManager.Reports property. The Reports is a collection of objects that implement the IReportSource interface. The IReportSource provides the interface to control a report generation by a report template.

The Document property provides the report template.

The RenderDocument() method returns the generated report.

The Prepare() method runs the asynchronous report generation process.

The RenderCompleted method notifies about the end of the generation.

The IReportSource interface is implemented for the ReportSlot type by default. ReportSlot is the base class for all types of slots. Its basic properties:

The Manager is an object of ReportManager, included in the ReportSlot component.

The StyleSheet is a collection of styles used to generate the report. If this property is set to null, then styles that stored in a document are used.

The ReportName property is a name of the report template. By this property the report template is called through IResolveSubReport interface implemented in ReportManager.

The SupportSave property specifies whether the report template to be saved.

The basic methods of the ReportSlot:

The SaveReport()

The LoadReport() method returns the report specified in a slot.

The next slot types are used to provide report templates:

The FileReportSlot is a report slot for report templates from files. The path to the file is specified in the File Path property.

The InlineReportSlot provides a template, serialized in the application code.

The UrlReportSlot provides a template obtained by the URL-address specified in the Url property.

The ReportManager executes the IResolveSubReports interface. This interface is required to obtain a bound report by the report name, i.e., to obtain subreports and main (master) reports by the assigned name.

The ReportManager chooses a template from the Reports collection by the assigned name. In addition, the ReportManager calls the ResolveSubReport event to get the template by its name.

Add Feedback