private void btnPrint_Click(object sender, RoutedEventArgs e) { try { PrintDialog printDialog = new PrintDialog(); if (printDialog.ShowDialog() == false) { return; } ComboBoxItem selectedMonth = (ComboBoxItem)cmbMonths.SelectedItem; string selectedYear = (string)cmbYear.SelectedItem; string documentTitle = "Statute Report For " + selectedMonth.Content.ToString() + " " + selectedYear; Size pageSize = new Size(printDialog.PrintableAreaWidth, printDialog.PrintableAreaHeight); StatuteReportPrinter paginator = new StatuteReportPrinter(dg60Days as DataGrid, dg180Days as DataGrid, dg1Year as DataGrid, dg2Years as DataGrid, dg3Years as DataGrid, dg5Years as DataGrid, documentTitle, pageSize, new Thickness(30, 20, 30, 20)); printDialog.PrintDocument(paginator, "Grid"); Helper.ShowInformationMessageBox("Statute Report Exported!", "Statute Report"); //var printDialog = new PrintDialog(); //if (printDialog.ShowDialog() == true) //{ // var paginator = new RandomTabularPaginator(50, // new Size(printDialog.PrintableAreaWidth, // printDialog.PrintableAreaHeight)); // printDialog.PrintDocument(paginator, "My Random Data Table"); //} } catch (Exception ex) { Helper.LogException(ex); } }
private void btnPrint_Click(object sender, RoutedEventArgs e) { try { PrintDialog printDialog = new PrintDialog(); if (printDialog.ShowDialog() == false) return; ComboBoxItem selectedMonth = (ComboBoxItem)cmbMonths.SelectedItem; string selectedYear = (string)cmbYear.SelectedItem; string documentTitle = "Statute Report For " + selectedMonth.Content.ToString() + " " + selectedYear ; Size pageSize = new Size(printDialog.PrintableAreaWidth, printDialog.PrintableAreaHeight); StatuteReportPrinter paginator = new StatuteReportPrinter(dg60Days as DataGrid, dg180Days as DataGrid, dg1Year as DataGrid, dg2Years as DataGrid, dg3Years as DataGrid, dg5Years as DataGrid, documentTitle, pageSize, new Thickness(30, 20, 30, 20)); printDialog.PrintDocument(paginator, "Grid"); Helper.ShowInformationMessageBox("Statute Report Exported!", "Statute Report"); //var printDialog = new PrintDialog(); //if (printDialog.ShowDialog() == true) //{ // var paginator = new RandomTabularPaginator(50, // new Size(printDialog.PrintableAreaWidth, // printDialog.PrintableAreaHeight)); // printDialog.PrintDocument(paginator, "My Random Data Table"); //} } catch (Exception ex) { Helper.LogException(ex); } }