Hey All,
I am stumped - I try to export a report document to any format like .pdf, .xls, .doc, .rtf and I consistently get the error:
Error in File C:\..\reportname.rpt: Operation not yet implemented
If I look at the line in debugger, with a watch, the value is:
Run-time exception thrown: System.NotSupportedException
The code I'm running looks like:
Dim ExportPath As String
ExportPath = Request.PhysicalApplicationPath
crDiskFileDestinationOptions = New CrystalDecisions.Shared.DiskFileDestinationOptions
determineReport(Session("ReportName"))
oRpt.Load(Server.MapPath("") + "\" + strReportName)
crExportOptions = oRpt.ExportOptions()
strPrintOption = cboChoice.SelectedItem.Text
Select Case cboChoice.SelectedItem.Text 'this contains the value of the selected export format.
Case "Rich Text (RTF)"
'--------------------------------------------------------------------
'Export to RTF.
'append a filename to the export path and set this file as the filename property for
'the DestinationOptions class
crDiskFileDestinationOptions.DiskFileName = ExportPath + "RichTextFormat1.rtf"
'set the required report ExportOptions properties
With oRpt.ExportOptions
.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile
.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.RichText
.DestinationOptions = crDiskFileDestinationOptions
End With
'--------------------------------------------------------------------
'--------------------------------------------------------------------
Case "Portable Document (PDF)"
'Export to PDF
'append a filename to the export path and set this file as the filename property for
'the DestinationOptions class
crDiskFileDestinationOptions.DiskFileName = ExportPath + "PortableDoc.pdf"
'set the required report ExportOptions properties
With crExportOptions
.DestinationOptions = crDiskFileDestinationOptions
.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile
.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.PortableDocFormat
End With
'--------------------------------------------------------------------
'--------------------------------------------------------------------
Case "MS Word (DOC)"
'Export to Word
'append a filename to the export path and set this file as the filename property for
'the DestinationOptions class
crDiskFileDestinationOptions.DiskFileName = ExportPath + "Word.doc"
'set the required report ExportOptions properties
With oRpt.ExportOptions
.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile
.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.WordForWindows
.DestinationOptions = crDiskFileDestinationOptions
End With
'--------------------------------------------------------------------
'--------------------------------------------------------------------
Case "MS Excel (XLS)"
'Export to Excel
'append a filename to the export path and set this file as the filename property for
'the DestinationOptions class
crDiskFileDestinationOptions.DiskFileName = ExportPath + "Excel.xls"
'set the required report ExportOptions properties
With oRpt.ExportOptions
.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile
.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.Excel
.DestinationOptions = crDiskFileDestinationOptions
End With
'--------------------------------------------------------------------
End Select 'export format
'Once the export options have been set for the report, the report can be exported. The Export command
'does not take any arguments
Try
oRpt.Export()
' create process to launch requested exported file type in corresponding application
createExportProcess()
Catch err As Exception
If err.Message = "Thread was being aborted." Then
createExportProcess()
Else
lblMessage.Text = err.Message.ToString '+ err.ToString
End If
End Try