Vasanth Natarajan

Vasanth Natarajan

  • 1.3k
  • 420
  • 46.8k

How to convert the .rpt to PDF Using c#?

Jul 15 2017 2:58 AM
I facing the Problem for converting the RPT to PDF (or) EXCEL Missing parameter!!
 Here by My code
 
ReportDocument cryRpt = new ReportDocument();
ExportOptions CrExportOptions;
cryRpt.Load(strpaths);//my rpt file

DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions();
ExcelFormatOptions CrFormatTypeOptions = new ExcelFormatOptions();
CrDiskFileDestinationOptions.DiskFileName = "c:\\csharp.net-informations.xls";
CrExportOptions = cryRpt.ExportOptions;
CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
CrExportOptions.ExportFormatType = ExportFormatType.Excel;
CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions;
CrExportOptions.FormatOptions = CrFormatTypeOptions;
cryRpt.SetDatabaseLogon(UserName, Password, ServerName, DatabaseName);
cryRpt.DataSourceConnections[0].IntegratedSecurity = false;
crystalReportViewer1.ReportSource = cryRpt;
cryRpt.ExportToDisk(ExportFormatType.Excel, "c:\\csharp.net-informations.xls");
 
I want to set the Parameter only in Crystalreport viewer after that i will convert the PDF or Excel file based on the parameter
 
 
 

Answers (2)