Custom ListView class for Report Generation, Part 1






2.95/5 (10 votes)
Mar 15, 2005

70522

1662
A simple class generating printible reports.
Introduction
I've been using nashcontrol for generating reports, but had a difficult time incorporating the code into existing applications. In addition, his control does not provide the same functionality for list view controls. Nash’s control also had a drawback that it would crash for spaces in the column titles. This control is basically a wrapper for quick integration into existing code for printing listview controls.
Using the code
MyListView
control is derived from System.Windows.Forms.ListView
, so use it like the native ListView
control. The only additional functionality is that for printing the ListView
.
// call the print method for displaying the Nash’s print dialog.
this.listView1.Print();
Points of Interest
In the report, the column width is determined by the width of the columns in the ListView
. For a detailed overview of the printing process, refer to the referenced article.
History
This is the first version, as soon as I get some time, I'll complete the tutorial.