HOW TO: Create an XtraReport from a ReportData Object

DevExpress has a nice module for their eXpressApp Framework called the Report Module.  The purpose of this module is to provide a reporting engine for your objects and allow you to generate reports through actions and in the UI.  So far, the biggest problem I have encountered with this is how to generate these reports outside of the Framework once they are designed a ready.  A typical scenario involves having a designed application and then needing to develop some sort of service process that fetches and sends reports on a daily basis.

As a work around, I’ve found out how to generate these reports as a simple XtraReport instead of a XafReport object.  The XtraReport class can be loaded from a stream which contains the layout in a byte array.  I simply read the layout from the persistent ReportData object into a byte array and load the XtraReport from it.  Here are some code examples:


Dim uowUnitOfWork As New  UnitOfWork(XpoDefault.DataLayer)
Dim obsObjectSpace As New ObjectSpace(uowUnitOfWork, XafTypesInfo.Instance)
Dim rptReportData As Reports.ReportData
Dim xfrReport As Reports.XafReport

rptReportData = obsObjectSpace.FindObject(Of Reports.ReportData)(Nothing)
xfrReport = rptReportData.LoadXtraReport(obsObjectSpace)


using( UnitOfWork uow = new UnitOfWork( XpoDefault.DataLayer ) ) {
        ObjectSpace objectSpace = new ObjectSpace( uow , new XpoTypesInfoAdapter(
uow.DataLayer.Dictionary ) );
        ReportData reportData = objectSpace.FindObject<ReportData>( new BinaryOperator( "Name",
"ContactsGroupedByPosition" ) );
        if( reportData != null ) {
            XafReport report = reportData.LoadXtraReport( objectSpace );
            report.ObjectSpace = objectSpace;

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>