Printing a .NET DataGridView

37,006

Solution 1

You could export the DataGridView to Excel and then print it from Excel.

You could also consider to not show your data in a DataGridView, but show it in a ReportViewer control, which has the ability to export to PDF or Excel. From there it's possible to print your data.

Solution 2

There are projects on CodeProject that have done some work printing DataGridViews.

Solution 3

I know you've already accepted an answer, but for the next person to search this question...

I also found this wonderful project on Code Project, and just implemented it. It was EASY and nice. http://www.codeproject.com/KB/grid/GridDrawer.Net.aspx

Solution 4

On CodeProject:

Another DataGridView Printer by aureolin

Above is another excellent DataGridView Printer that is extremely simple to implement.

I realize I am a Johnny Come Lately to this thread. I stumbled upon it while searching for something else, but wanted to reference this excellent printing solution for others who happen by this way (as I did).

I hope someone here gets some use out of it.

Solution 5

There is no built-in print support I'm afraid.

You might resort to using a third party control such as the Infragistics WinGrid which has build-in support for printing.

Share:
37,006
Tina Orooji
Author by

Tina Orooji

Updated on January 12, 2020

Comments

  • Tina Orooji
    Tina Orooji over 4 years

    I am fairly new to .NET and C#, but I have a DataGridView that I would like to print. What would be the best way to go about doing so?