Merrion
12-01-2005, 08:02 AM
This class allows you to print data grids across multiple pages (both multiple pages across and down...) and to specify a header, column header styles, footer etc.
There is an article on the code project (http://www.thecodeproject.com/vb/net/DataGridPrinter.asp) that explains the details...
Merrion
04-06-2006, 02:15 PM
New release that allows you to span the grid across multiple pages and also fixes a bug (which was causing the last column to overflow when it would actually fit...)
Merrion
09-03-2007, 07:10 AM
New release
(1) Can print DataGridView as well as DataGrid controls
(2) Has event to allow you to change the colours of individual cells
Private Sub GridPrinter_QueryCellFormat(ByVal sender As Object, ByVal e As QueryCellFormatEventArgs) Handles GridPrinter.QueryCellFormat
'\\ Top 2 clubs go up
If e.RowNumber <= 2 Then
e.BackgroundColour = Brushes.AliceBlue
End If
If e.ColumnNumber = 0 Then
If e.CellData.ToString = "Grimsby" Then
e.TextColour = Brushes.RoyalBlue
End If
End If
'\\ Bottom 2 columns relegation
If e.RowNumber >= 23 Then
e.BackgroundColour = Brushes.LightGray
End If
End Sub
(3) Has an event to allow you to change the text in a cell
Private Sub GridPrinter_QueryCellData(ByVal sender As Object, ByVal e As QueryCellDataEventArgs) Handles GridPrinter.QueryCellData
If e.ColumnNumber > 0 And e.CellText = "0" Then
e.CellText = "Zero"
End If
End Sub