Symptom
- Exporting reports with images to Adobe PDF
- Most reports work
- Some reports throw the following error;
CrystalDecisions.CrystalReports.Engine.ExportException: Error in File temp_54bf964f-5a8a-474a-9365-1b533f24928e {A8FDD84E-3F98-4B3F-A0CF-ED7848AC0D00}.rpt: Error detected by export DLL: ---> System.Runtime.InteropServices.COMException: Error in File temp_54bf964f-5a8a-474a-9365-1b533f24928e {A8FDD84E-3F98-4B3F-A0CF-ED7848AC0D00}.rpt: Error detected by export DLL: at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext) at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext) --- End of inner exception stack trace --- 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.ReportDoc
ument.ExportToStream(ExportOptions options) at CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(ExportFormatType formatType) at CrystalReportsProblem.Form1.CreateReport() in C:\temp\CrystalReportsProblem\Form1.vb:line 116 at CrystalReportsProblem.Form1.Form1_Load(Object sender, EventArgs e) in C:\temp\CrystalReportsProblem\Form1.vb:line 8
Environment
- Crystal Reports for Visual Studio 2010
- VS2010
Reproducing the Issue
- Code used:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
''The path/location where the exported file will be saved
Dim exportFilePath As String = Application.StartupPath + "\exported.pdf"
''Create an instance of the Chart report
crReportDocument = New Chart()
''Set the options for saving the exported file to disk
crDiskFileDestinationOptions = New DiskFileDestinationOptions()
crDiskFileDestinationOptions.DiskFileName = exportFilePath
''Set the exporting information
crExportOptions = crReportDocument.ExportOptions
With crExportOptions
.DestinationOptions = crDiskFileDestinationOptions
.ExportDestinationType = ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType.PortableDocFormat
End With
''Export the report
crReportDocument.Export()
''Display a message letting the user know the export is complete
MessageBox.Show("Report exported to: '" & exportFilePath & "'")
End Sub
- The same error is thrown exporting the report by use of the viewer export button
Cause
-
In some cases, the image height and width is set to 0 (zero)
ReportPicture = CType(oRpt.ReportDefinition.ReportObjects("picPKU"), CrystalDecisions.CrystalReports.Engine.PictureObject)
ReportPicture.Height = 0
ReportPicture.Width = 0
Resolution
- Do not use height and width of zero
Keywords
CR2010 2010 CR4VS2010 CR4VS VS2010 NET2010 Crystal Reports for .NET Framework 4.0 crforvs 13 picture , KBA , BI-DEV-NET-SDK , .NET SDK / COM SDK , How To