Suppress Exporting Crystal Report as PDF IF No Data
Posted on 2007-12-06
I batch export several Crystal Reports as PDF using a VB.NET 2003 Windows application. However, since I am exporting to PDF and not printing, I cannot suppress if there are no records anymore. The property the report has to suppress printing if no data doesn't apply to exporting as PDF. Therefore, I end up with several PDFs that are blank because they did not have any records.
I'm using the ReportDocument (CR) class and the CR.ExportOptions process to export. Here's a sample of what I do after the report is ready to be exported.
Dim CR as New ReportDocument
..' provide path to open the report and enter parameters here too.
' Set the destination to a disk file
.ExportDestinationType = ExportDestinationType.DiskFile
' Set the format to PDF
.ExportFormatType = ExportFormatType.PortableDocFormat
' Set the destination options to DiskFileDestinationOptions object
.DestinationOptions = CrDiskFileDestinationOptions
.FormatOptions = CrFormatTypeOptions
' Export the report to the PDF folder path
Is there a way to stop the exporting process if the report is blank or has no records? I was hoping to use something like size property, but I can't find it.
Any help would be tremendously appreciate it.