Working with unattended reports

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 view.

Execute this report and it will be printed out in your default printer.

As a side note, 
Yes, we are using the embedded WebBrowser control, and yes, it is possible to print html without showing the print preview dialog. ;)

You can get the source code of NRapid from here
And the sample app from here
The Northwind database is available from download at


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