Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exporting cr 9 results in "Error in file" - ??

Status
Not open for further replies.

majordog

Programmer
Jul 8, 2002
222
0
0
CA

I'm looking for some help understanding why these crystal report 9 files will not export. I have gone over the code and am confident that it is correct, albeit, perhaps I am missing a step I am unaware of (I will post below). Regardless, when I hit the oRpt.Export - I always get an error saying "Error in file: C:\filepath\reportname.rpt Operation Not Implemented" And I am at a loss. I am using VS 2003, vb.net in an asp.net web application and crystal reports 9. This is an intranet site. Below is the code. The connection I am saving with the report in crystal itself and just loading as is into the crystalReportViewer. Here is my code, and any help, much appreciated:


Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports CrystalDecisions.Web

****************************************
Dim ExportPath As String
Dim FilePath As String = strReportName
ExportPath = Request.PhysicalApplicationPath

crDiskFileDestinationOptions = New CrystalDecisions.Shared.DiskFileDestinationOptions
determineReport(cboChoice.SelectedItem.Text)

crExportOptions = oRpt.ExportOptions()

strPrintOption = cboChoice.SelectedItem.Text

Select Case strPrintOption '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

Try

FilePath = (ExportPath + "Reports\" + FilePath)

blnReport = True
oRpt.Load(FilePath)
connect()

oRpt.Export()


oRpt.Close()
redirect()

Catch err As Exception


lblMessage.Text = err.Message.ToString

End Try


*****************************************

Private Sub connect()

crConnectionInfo.ServerName = "E"
crConnectionInfo.UserID = "R"
crConnectionInfo.Password = ""
crConnectionInfo.DatabaseName = "E"
myLogin.ConnectionInfo = crConnectionInfo
crInfos.Add(myLogin)
crystal.LogOnInfo = crInfos

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top