Posts

Showing posts from August, 2012

Bending reports with NRapid

Image
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 lik…

Printing html using the embedded web browser control

Image
In this post I’ll try to answer some questions about the web browser control and provide some workarounds for known issues involved in the printing process.
I'm assuming that you have some experience with the web browser control and basic knowledge of COM and hosting APIs. So I’m not going to cover those topics.
At the bottom of this page I’ve added the links to download a small library I wrote that takes care of printing HTML and a demo app so you can try it out without having to write any code by yourself.
Using the code The HtmlPrinter class will allow you to print html from an URL or just passing the html as string, you can also specify the title and the number of copies you want to print. The code may look something like this: Now that we know how to use the API let get answer some questions.
Why my app crashes when I try to print multiple copies of a page? Well, apparently when you send a lot of print commands to the web browser control, there is a lot of COM crap in between that l…

Working with unattended reports

Image
In this post I‘ll show you how to create reports that NRapid will execute into an unattended mode. I strongly recommend using this kind of reports in automation scenarios only, and let the user see the print preview dialog in the rest of cases.

The only difference between this reports and the standard ones, is that you will cannot make use of dialogs, the runtime will always pass in empty views to the ConfigureReport method. The ConfigureReport method will be executed, but you will have to grab the arguments from somewhere else. The execution pipeline is the same that NRapid uses for standard reports.

This is the code to print out the whole list of categories in a dialogless mode.
Notice that this report inherits from UnattendedReport class, this class tells to NRapid “run the report unattended”. Also notice that this class comes with a convenience method to configure the report with no arguments. You still can override the one that gets the view data but you will always get an empty vi…