ReportDocument report = new ReportDocument(); report.Load("DiffFileFormatRpt.rpt"); report.SetDatabaseLogon("user","passwdor","route","database"); string filetype = cmbFileFomats.Text; CrystalDecisions.Shared.ExportFormatType efileType = (CrystalDecisions.Shared.ExportFormatType)Enum.Parse(typeof(CrystalDecisions.Shared.ExportFormatType), filetype); switch (efileType) { case CrystalDecisions.Shared.ExportFormatType.Excel: report.ExportToDisk(efileType, "reportExcel.xls"); break; case CrystalDecisions.Shared.ExportFormatType.ExcelRecord: report.ExportToDisk(efileType, "reportExcel.xls"); break; case CrystalDecisions.Shared.ExportFormatType.HTML32: report.ExportToDisk(efileType, "reporthtml.html"); break; case CrystalDecisions.Shared.ExportFormatType.HTML40: report.ExportToDisk(efileType, "reporthtml.html"); break; case CrystalDecisions.Shared.ExportFormatType.NoFormat: report.ExportToDisk(efileType, "reportExcel.xls"); break; case CrystalDecisions.Shared.ExportFormatType.PortableDocFormat: report.ExportToDisk(efileType, "reportpdf.pdf"); break; case CrystalDecisions.Shared.ExportFormatType.RichText: report.ExportToDisk(efileType, "reportrtf.rtf"); break; case CrystalDecisions.Shared.ExportFormatType.WordForWindows: report.ExportToDisk(efileType, "reportdoc.doc"); break; default: break; }
report.ExportToDisk(efileType, "reportExcel.xls"); //instead of this give full path report.ExportToDisk(efileType, "D:\reportExcel.xls");
CrystalReport1 cr = new CrystalReport1(); cr.SetDataSource(ds.Tables[0]); cr.ExportToDisk(ExportFormatType.PortableDocFormat, @"E:\Bills\OK.pdf"); cr.SetDataSource(ds); crystalReportViewer1.ReportSource = cr;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)