public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { rptUser rpt = new rptUser(); rpt.Site = this.Site; return(rpt); }
private void btnPrint_Click(object sender, EventArgs e) { DataTable dtUsers = new clsUsers().GetUsers(); Reports.rptUser rptUser = new Reports.rptUser(); SaveFileDialog saveFileDialog = new SaveFileDialog(); if (dtUsers.Rows.Count > 0 && saveFileDialog.ShowDialog() == DialogResult.OK) { rptUser.SetDataSource(dtUsers); rptUser.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.Excel, saveFileDialog.FileName); rptUser.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, saveFileDialog.FileName); MessageBox.Show(" File Download Successfully :) ", "This msg", MessageBoxButtons.OK, MessageBoxIcon.Information); } rptUser.Close(); rptUser.Dispose(); }