Printing DataGridView C #

1

I need to print the selected columns in a DataGridView. I can not generate an image because there are many columns (15 in all) and they do not all appear on the screen. I can print in landscape or portrait as long as all the information appears. The data is not many that will be selected (maximum of 10), but I can not print all the columns. Can anyone help me?

    
asked by anonymous 16.05.2017 / 22:11

1 answer

0

Resolved: I used DGVPrinter.

The button looks like this:

private void btPrint_Click(object sender, EventArgs e)
        {
            this.printDocument1.DefaultPageSettings.Landscape = true;
            DGVPrinter printer = new DGVPrinter();
            printer.PrintDataGridView(dataGridView1);

        }

I added the class DGVPrinter.cs link to the project and in the datagrid form I put it in using .

Prints in landscape and portrait, just select the printer and, if you want to select the columns to print, just have print selection selected.

    
17.05.2017 / 01:55