Working with FlexReport > Data Binding in FlexReport > Using Custom Data Source Objects |
You can use custom objects as data sources. The only requirement is that the custom object must implement the IC1FlexReportRecordset interface.
IC1FlexReportRecordset is a simple and easy-to-implement interface that can be added to virtually any collection of data with ease. This is often more efficient than creating a DataTable object and copying all the data into it. For example, you could use custom data source objects to wrap a file system or custom .xml or .flxr files.
To use custom data source objects, load the report definition and then assign the object to the C1FlexReport's Recordset property. For example:
' get custom data source object Dim rs As IC1FlexReportRecordset = CType(GetMyCustomDataSource(), IC1FlexReportRecordset) ' load report definition (before setting the data source) C1FlexReport1.Load(@"reportFile", "reportName") ' use custom data source object in C1FlexReport component C1FlexReport1.DataSource.Recordset = rs
// get custom data source object IC1FlexReportRecordset rs = (IC1FlexReportRecordset)GetMyCustomDataSource(); // load report definition (before setting the data source) c1FlexReport1.Load(@"reportFile", "reportName"); // use custom data source object in C1FlexReport component c1FlexReport1.DataSource.Recordset = rs;