The following example demonstrates how to implement a report storage to persist report definitions in a database or in any other custom location. This may be useful when providing end-users with the capability to create and customize reports using XtraReports End-User Designer, if it is necessary to have a common target for saving and sharing all reports.
The default report serialization mechanism does not support the serialization of a report's data source. The following examples illustrate how you can provide a custom XML serialization logic for a report's data source as well as its custom parameters.
- How to implement custom XML serialization of a report that is bound to a dataset;
- How to serialize an XPO data source;
- How to serialize parameters of custom types.
Question Comments
Added By: (no info) at: 10/8/2012 10:48:21 AM
There is a slight error in the example if you are using a different XPO provider. The call to create the XpoReportStorage is prior to setting the default DataLayer. This results in the default MS Access DataLayer being used in the XpoReportStorage parameter. Changing the statement (as indicated below) will result in the expected behavior:
string conn = SQLiteConnectionProvider.GetConnectionString(@"c:\temp\ReportStorage.sqlite");
XpoDefault.DataLayer = XpoDefault.GetDataLayer(conn, AutoCreateOption.DatabaseAndSchema);
reportStorage = new XpoReportStorage(new UnitOfWork());
A hint for all those wo tried this with version 13.1.4:
This Example can not be built as-is using DevExpress 13.1.4 even after project conversion.
The ZipReportStorage.cs contains renamed classes:
- ZipFileCollection is now named InternalZipFileCollection
- ZipFile is now named InternalZipFile
- ZipArchive is now named InternalZipArchive
After renaming all occurences of those classes with the new names everything works just fine.
Added By: BINITR at: 10/25/2013 2:18:39 PMI'm trying to connect to the datasource Sqlite but I can not figure out how to do. I also downloaded the componeti OleDb for Sqlite but without result.
Added By: Wim Koppelaar at: 5/24/2015 2:59:21 AMNice example of the possibillities. But I don't understand where StorageDataSet is comming from?
Added By: Vasily (DevExpress Support) at: 5/25/2015 5:56:39 AM Hi Wim,StorageDataSet is a regular DataSet class created by using the Visual Studio DataSet designer. Note that not all project files are usually displayed in the file selection combo box of the code example. So, if you have any questions regarding the example implementation, it is better to download the whole code example project and review its source code in the Visual Studio IDE. Please refer to the following ticket for more information: How to download code examples.
Added By: Yohan Dole 1 at: 12/17/2015 7:22:53 PMI tried to change the DataSet to a MS-SQL Table....but keep getting a "Cannot implicitly convert type 'ReportStorageSample.DataSet1.reportsRow' to 'ReportStorageSample.StorageDataSet.ReportStorageRow' " .. This is caused by the field "Buffer" which is varbinary on the DB side.
Added By: Jannet (DevExpress Support) at: 12/17/2015 10:37:11 PM Hello Yohan,To handle your inquiry in the most efficient manner, let's continue our discussion at Report & Sub Report stored in a Database Table.