I'm running the following code:
ReportDocument crystalReport = new ReportDocument();
crystalReport.Load(reportPath);
DataTable dtReportData;
DbUtils.GetSqlResult(dataQuery, out dtReportData);
crystalReport.SetDataSource(dtReportData);
var crDiskFileDestinationOptions = new DiskFileDestinationOptions();
var crFormatTypeOptions = new PdfRtfWordFormatOptions();
crDiskFileDestinationOptions.DiskFileName = pdfFilePath;
crystalReport.PrintOptions.PaperOrientation = PaperOrientation.Landscape;
var crExportOptions = crystalReport.ExportOptions;
{
crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
crExportOptions.DestinationOptions = crDiskFileDestinationOptions;
crExportOptions.FormatOptions = crFormatTypeOptions;
}
crystalReport.Export(); //PROGRAM FAILS HERE WHEN THE DATATABLE CONTAINS 900 OR MORE ROWS
crystalReport.Close();
And it fails when trying to export to pdf a report that has as datasource a table that has more than 900 rows. The exception is:
The Report Application Server failed
And the stacktrace is:
at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e) at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext) at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext) at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export(ExportRequestContext reqContext) at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export() at CrystalDecisions.CrystalReports.Engine.ReportDocument.Export()
Any idea how to approach this problem?
UPDATE
When using Crystal Reports Viewer, I can export the report to PDF while doing the same action from the Crystal Reports Designer is resulting in an error. Is there a way programatically to use the viewer's libraries when exporting a crystal reports object?