Export from Crystal Reports to PDF using VB.NET

Exporting to PDFApparently, this is as simple as :

rep.ExportToDisk(ExportFormatType.PortableDocFormat, myFileName)

 

The longer way of doing it (If you need more options) is shown on the Business Objects Knowledgebase. (CS/C++ Versions also available on the site).

Private Sub ExportToDisk(ByVal fileName As String)

Dim diskOpts As DiskFileDestinationOptions = _
ExportOptions.CreateDiskFileDestinationOptions()

' set the export format
Dim exportOpts As ExportOptions = New ExportOptions()
exportOpts.ExportFormatType = _
ExportFormatType.RichText
exportOpts.ExportDestinationType = _
ExportDestinationType.DiskFile

' set the disk file options
diskOpts.DiskFileName = fileName
exportOpts.ExportDestinationOptions = diskOpts

Report.Export(exportOpts)

End Sub

Leave a Comment

Your Comment