Link to home
Start Free TrialLog in
Avatar of TheUndecider
TheUndeciderFlag for United States of America

asked on

Suppress Exporting Crystal Report as PDF IF No Data

Hello,

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.

With CrExportOptions
        ' 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
End With
' Export the report to the PDF folder path
CR.Export()

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.
ASKER CERTIFIED SOLUTION
Avatar of habibb
habibb
Flag of Pakistan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Forced accept.

Computer101
EE Admin