public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { PrintReport rpt = new PrintReport(); rpt.Site = this.Site; return(rpt); }
private void buttonGenerateReport_Click(object sender, EventArgs e) { List<PersonInfo> personInfos=new List<PersonInfo>(); try { if (excelFilePath != String.Empty) { string table = comboBoxExcelTable.SelectedValue.ToString(); PrintReport printReport = new PrintReport(); LastPartReport lastPartReport=new LastPartReport(); DataTable dt = reader.ExcelFile(excelFilePath, table); personInfos = dt.AsEnumerable().Select(dataRow =>new PersonInfo() { Name = dataRow[0].ToString().Trim(), Amount = Convert.ToInt32(dataRow[1].ToString().Trim()), AmountInWord = NumberToText(Convert.ToInt32(dataRow[1].ToString().Trim())), Day = DateTime.Now.ToString("dd").Insert(1, " "), Month = DateTime.Now.ToString("MM").Insert(1, " "), Year = DateTime.Now.ToString("yyyy").Insert(1, " ").Insert(4, " ").Insert(7, " ") }).ToList(); if (checkBoxAllpart.Checked) { printReport.SetDataSource(personInfos); PrintReportViewer.ReportSource = printReport; } else { lastPartReport.SetDataSource(personInfos); PrintReportViewer.ReportSource = lastPartReport; } } else { MessageBox.Show("Please select excel file.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } // comboBoxExcelTable.Items.Clear(); //excelFilePath = String.Empty; } catch (Exception exception) { MessageBox.Show(exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { PrintReport rpt = new PrintReport(); rpt.Site = this.Site; return rpt; }