Print Datagridview data without dark background

Asked

Viewed 30 times

0

Hello! I have a code that prints out data from DataGridView, however, I modified the colors of it. Thus the code incorporates the color of the DataGridView to the printing page. I would like the code to just print the table data, without adding the colors of the DataGridView. I used to print the table, a code called Dgvprinter.

private void btImprimirUsuarios_Click(object sender, EventArgs e)
{
            using (PrintDocument print = new PrintDocument())
                print.DefaultPageSettings.Landscape = true;
            DGVPrinter printer = new DGVPrinter();
            printer.TitleFont = new Font("Arial", 10, FontStyle.Bold);
            printer.Title = "LOGS DO SISTEMA - USUÁRIOS - SISTEMA DE MARCAÇÃO DE ÔNIBUS DA SAÚDE - MarcaBUS";
            printer.SubTitleFont = new Font("Arial", 8, FontStyle.Regular);
            printer.SubTitle = "Desenvolvido pela Divisão de Tecnologia da Informação - Prefeitura Municipal de João Monlevade";
            printer.SubTitleSpacing = 5;
            printer.SubTitleFormatFlags = StringFormatFlags.LineLimit | StringFormatFlags.NoClip;
            printer.PageNumbers = false;
            printer.PageNumberInHeader = false;
            printer.PorportionalColumns = true;
            printer.RowHeight = DGVPrinter.RowHeightSetting.CellHeight;
            printer.HeaderCellAlignment = StringAlignment.Near;
            printer.FooterFont = new Font("Arial", 8, FontStyle.Regular);
            printer.Footer = "Sistema MarcaBus - Copyright© 2020 Todos os Direitos Reservados";
            printer.FooterSpacing = 5;
            printer.DocName = "Logs de Cadastros, Exclusões e Alterações de Usuários - Marca Bus";
            printer.PrintPreviewDataGridView(dgvUsuarios);
}

How does it look:

DataGridView

How I need you to stay:

DataGridView

Can someone help me?

  • this variable is what: DGVPrinter?

  • I used yes, the DGVPrinter - @Virgilionovic

  • what is ??? DGVPrinter

  • https://www.codeproject.com/Articles/18042/Another-DataGridView-Printer

  • 1

    Version 1.2 - Finally (I Believe!), Fixed the string/column Alignment problems. Also prints Cell background Colors properly, respecting the alternating Rows style !!! that is, the color comes from Gridview and you need to then send a Gridview correctly... OK!

  • 3

    before printing puts the color you want, dps back to normal color

Show 1 more comment
No answers

Browser other questions tagged

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