Printing Datagridview C#

Asked

Viewed 930 times

0

I need to print the selected columns in a Datagridview. I can not generate image, because there are many columns (15 in all) and not all appear on the screen. I can make the impression in landscape or portrait, as long as all the information comes in. The data are not many that will be selected (maximum of 10), but I cannot fail to print all columns. Can someone help me?

  • You want to create an option that prints all columns and others only selected?

  • All columns, but only selected rows. One print only.

1 answer

0


Solved: I used the Dgvprinter.

The button went 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 Dgvprinter.Cs class https://drive.google.com/file/d/0BwBxpfm3kmmgci1aSnZ6T0RudGc/view to the project and, in the form of datagrid.

Print in landscape and portrait, just select from the printer, and if you want to select the columns to be printed, just print the selection.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.