100% DX – XtraReports : bye bye Crystal, sorry ActiveReports


What’s the first thing that comes to your mind when I mention reporting? Crystal? ActiveReports? I have used these and others on numerous projects, but then I learnt about Developer Express XtraReports, lets see if XtraReports can make it into the 100% DX range…

For a full run down on all the cool things you can achieve, check out the Developer Express web site, this post is about filling a need, quickly.

As part of the RetailOne Connect system, we needed to print a purchase order, nothing complex, just a nice looking report that can be updated from time to time. It was important to be able to export as a pdf, and generate the document quickly.

The report designer was just as friendly as expected, with a drag drop approach for fields, or a nice selection of other tools available in the toolbox,

Creating bands is a simple right click, inserting sub reports just as simple.

In the case of R1, I didn’t need any scripting or code behind, but I couldn’t help having a play first.

What really surprised me with the ease of implementing in the code:

A complete preview version of the order could be generated with as little as:

Dim report As PurchaseOrder = New PurchaseOrder()
report.DataSource = db.OrderSummaries.Where(Function(p) p.OrderID = OrderID)
report.ShowPreview()

The preview window has an amazing amount of options available, page layouts, colours, watermarks, export to PDF, JPG — you name it !

And a quick send order as PDF via email client was a matter of:

Create PDF from report:
Dim path As String = GetTempOrderPath()
Dim report As PurchaseOrder = New PurchaseOrder()
report.DataSource = db.OrderSummaries.Where(Function(p) p.OrderID = OrderID)
report.ExportToPdf(path)

Create Email with attachment:
Dim mail As SendFileTo.MAPI = New SendFileTo.MAPI
mail.AddAttachment(path)
mail.AddRecipientTo(Supplier.Contact, Supplier.Email)
mail.SendMailPopup(String.Format("Purchase Order {0}", OrderNumber), "Please find attached purchase order.")

For me there is no choice now, I will be sticking with XtraReports in all our projects. When I do a more complex layout or code behind I will do another post and report my findings.

My only complaint is that they don’t offer a version for Objective-C …. maybe in the future?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: