Store Reports in the Report Designer
- 2 minutes to read
This document describes how to implement a report storage to persist report definitions in a database or in any other custom location. This enables end-users to create and customize reports in the Report Designer and have a common target for saving and sharing all reports.
To accomplish the described functionality, do the following.
Create a custom report storage object by implementing the IReportStorage interface.
Override the following methods provided by the IReportStorage interface.
- IReportStorage.CanCreateNew - Indicates whether or not it is possible to create a new tab with a blank report in the Report Designer.
- IReportStorage.CreateNew - Creates a new report.
- IReportStorage.CreateNewSubreport - Creates a new subreport.
- IReportStorage.CanOpen - Indicates whether or not the Open command is available.
- IReportStorage.Open - Opens a report selected by an end-user using a custom dialog.
- IReportStorage.Load - Loads a report with the specified ID that has been selected using the Open method. You can use the IReportSerializer functionality to save or load a given report from a stream.
- IReportStorage.GetErrorMessage - Displays an error message for any encountered exception.
IReportStorage.Save - Saves the currently edited report. The method’s parameters are the following.
- reportID specifies an unique ID of the edited report.
- reportProvider allows you to access the actual report instance being edited and optionally rename it.
- saveAs indicates which particular command has been executed (Save or Save As).
- reportTitle specifies the actual report title.
- designer specifies the actual report designer instance.
After you have defined the custom report storage type, assign it to the ReportDesignerBase.ReportStorage property (for instance, in the Window’s Loaded event handler).
- Online Example: WPF End-User Report Designer - How to Implement a Report Storage
- Implement the IConnectionProviderService interface to save and restore data source connections when users load the report from storage.