The report engine has two places to get the report name from;
The report summary
The report temp name; on report load, the rpt file is actually broken up into a number of files and these are saved to %TEM%. These files are used by the engine to now do it's work. E.g.; the actual report is never used. Since your report does not have the name of the report in the report summary, the engine defaults to using the temp rpt name.
Two ways out of this;
1) Ensure that all reports have a name noted in the report summary information
2) Set the summary info for the report at runtime and use that. The code would look something like this:
Dim crReportDocument As New CrystalDecisions.CrystalReports.Engine.ReportDocument Dim exportFilePath As String = Application.StartupPath + "\exported.pdf" Dim myExportOpts As New ExportOptions Dim diskOpts As DiskFileDestinationOptions diskOpts = ExportOptions.CreateDiskFileDestinationOptions() Dim pdfOptions As CrystalDecisions.Shared.PdfFormatOptions = New PdfFormatOptions() crReportDocument.Load("C:\tests\Drill Down Group Level.rpt") crReportDocument.SummaryInfo.ReportTitle = "Hello World" myExportOpts.ExportFormatType = ExportFormatType.PortableDocFormat myExportOpts.ExportDestinationType = ExportDestinationType.DiskFile myExportOpts.ExportDestinationOptions = diskOpts diskOpts.DiskFileName = exportFilePath pdfOptions.CreateBookmarksFromGroupTree = True ''Export the report crReportDocument.Export(myExportOpts) ''Display a message letting the user know the export is complete MessageBox.Show("Report exported to: '" & exportFilePath & "'")
- Ludek