Bending reports with NRapid

In a previous post we saw how to override report’s default format using the SetRawStyle extension method. This allows us to modify the layout and do quick fixes without touching style sheet. That’s quite handy, but if you have to add a lot of format your code will end up looking messy.

In this post I’ll work with a shipping report and show you how to bend reports using the NRapid’s fluent API. So let get started.


This is the first draft
And the output should look something like this:
As you can see we have some sort of shipping info of customer's orders. I don’t know if I've covered how to add footers in previous posts, I’ll check on that later and if I didn’t, I will. But for now, let just concentrate on formatting only.

First of all I don’t like the way the footer is formatted by default. I cannot see the difference between footers and standard rows, so I’m gonna format the footer’s text to bold, just for start.

Now this is the output:
That’s a little better, but still don’t like it. The alignment is wrong and I would like to see the dollar sign just to be clear that we are talking about money. Let tweak this a little bit.
And this is a nice formatted report:
Now I get the format I wanted but I'm not done yet. To finish this report I want to add some functionality, something that allows the user to click on the footer and see a detailed view of that info.

This is the code we need in order to add a link to the footer and finish our report:


And this is the final result:
Now you can replace the message box with a useful report and you’re pretty much set ;)


You can get the source code of NRapid from here
And the sample app from here
The Northwind database is available from download at http://www.microsoft.com/en-us/download/details.aspx?id=23654

Comments

Popular posts from this blog

How to create MS Word documents from Office templates using C#

Printing html using the embedded web browser control

WinForms, paging the DataGridView the right way