private void setupDefaultPrinting(PrintDialog dialog) { dialog.PrinterSettings.DefaultPageSettings.Landscape = true; dataGridViewPrinter = new DataGridViewPrinter(printDataGridView, printDocument, false, true, Text, new Font("Segoe UI", 10, FontStyle.Bold, GraphicsUnit.Point), Color.Black, true); dataGridViewPrinter.TruckText = dataGridView.Rows[0].Cells[findColumnIndex("truck")].Value.ToString(); if (!tsmiT1.Font.Bold && !tsmiGoodsList.Font.Bold && !tsmiCustoms.Font.Bold) { dataGridViewPrinter.TotalCll = (int)calculateSum("cll_rcvd"); dataGridViewPrinter.TotalKg = calculateSum("kg_rcvd"); dataGridViewPrinter.TotalM3 = calculateSum("m3"); } if (tsmiGoodsList.Font.Bold) { dataGridViewPrinter.TotalCll = (int)calculateSum("PKGS"); dataGridViewPrinter.TotalKg = calculateSum("Paino"); } }
private bool SetupPrinting() { SetupDataGrid(); PrintDialog dialog; if ((dialog = SetupDialog()) == null) { return false; } dialog.PrinterSettings.DefaultPageSettings.Landscape = true; //if (MessageBox.Show("Do you want the report to be centered on the page", "InvoiceManager - Center on Page", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) // MyDataGridViewPrinter = new DataGridViewPrinter(MyDataGridView, MyPrintDocument, true, true, "Customers", new Font("Tahoma", 18, FontStyle.Bold, GraphicsUnit.Point), Color.Black, true); //else dataGridViewPrinter = new DataGridViewPrinter(printDataGridView, printTableDocument, false, true, Text, new Font("Segoe UI", 10, FontStyle.Bold, GraphicsUnit.Point), Color.Black, true); if (csLoadingList.CheckedButton != null) { dataGridViewPrinter.TruckText = dataGridView.Rows[0].Cells[dgvp.IndexOf("truck")].Value.ToString(); if (!tsmiT1.Font.Bold && !tsmiGoodsList.Font.Bold && !tsmiCustoms.Font.Bold) { dataGridViewPrinter.TotalCll = (int)dataGridView_ColumnSum("cll_rcvd"); dataGridViewPrinter.TotalKg = dataGridView_ColumnSum("kg_rcvd"); dataGridViewPrinter.TotalM3 = dataGridView_ColumnSum("m3"); } if (tsmiGoodsList.Font.Bold) { dataGridViewPrinter.TotalCll = (int)dataGridView_ColumnSum("Pkgs"); dataGridViewPrinter.TotalKg = dataGridView_ColumnSum("Paino"); } } return true; }