I am generating crystal report from c# code. My dataset has 10 columns. The data is dynamic. The report is generating fine with the data at runtime. But the format is the default crystal format without the tabular format. I want to display the data in table format like the tables in excel. How do I go about it?
Following is the code block I am using to generate crystal report.
using (ReportDocument rd = new ReportDocument())
{
CrystalReportFilePath = ConfigurationManager.AppSettings["crystal_report_file_path"];
crystalReportFileName = "client_Details.rpt";
pdfFileName = clientName + " - " + reportMonth + ".pdf";
string rptFilePath = string.Format(@"{0}\{1}", CrystalReportFilePath, crystalReportFileName);
rd.Load(rptFilePath);
rd.SetDataSource(tempds);
rd.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
DiskFileDestinationOptions crDiskFileDestinationOptions = new DiskFileDestinationOptions();
rd.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
crDiskFileDestinationOptions.DiskFileName = string.Format(@"{0}\{1}", CrystalReportFilePath, pdfFileName);
rd.ExportOptions.ExportDestinationOptions = crDiskFileDestinationOptions;
rd.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
rd.VerifyDatabase();
rd.Export();
}
We are using crystal report 2008. In this version we don't have the tabular format. Instead we have to select the fields, assign borders to each field and arrange them in a tabular format. Its a pain but that's how it is.
And for different colors for alternate rows as in Excel, we have to write a formula in section expert -> details -> color tab