Tuesday, January 17, 2006

ASP.NET 2.0 and Crystal Reports

After a long rest I am back blogging.

Recently I have been spending a lot of time with Visual Studio 2005 exploring both ASP.NET and traditional Windows Forms projects.

I have a client in a medium sized company that has struggled with report distribution off and on for sometime. Having a small IT staff they wanted easy desktop installation along with “pretty” report printing capability from the client.

We discussed using Visual Studio 2003 and Crystal Reports with the Crystal Report Viewer control. Actually, a while back I did a small prototype and had many issues; finally we gave up and moved on to other projects.

Enter Visual Studio 2005. I decided to give it a try. In less than one hour I had a simple Crystal Report being displayed on a ASP.NET 2.0 web form. First, I populated a dataset with data for the report using ADO.NET (nothing special here). I created a rather simple Crystal Report using the Crystal Report wizard. Next, I bound the Crystal report to the dataset. Finally, I used the Crystal Report viewer control on a Web form to show the Crystal Report in the browser and provide formatted printing capability. It worked with no difficulty.

The two cool things about the process were using a 1) dataset as a data source for the crystal report (as opposed to having crystal do the data population) and 2) Adobe Reader is used to display the report when the client decides to print it at the browser; this lets a client choose the printer they want to use for printing (along with all the other printing goodies) and prints a formatted report (i.e. real page breaks etc) or for that matter export to a different format (word, pdf, excel). Since most desktop’s these days have Adobe Reader this technique for printing works like a champ. The biggest item however was that I had no problems doing this on an ASP.NET 2.0 page whatsoever; everything worked as advertised.

This is one possible solution for providing well formatted printed reports from a browser.

The client loved it and has begun to deploy various reports using this approach.

0 Comments:

Post a Comment

<< Home