Solved

Report Document export not working...

Posted on 2004-03-22
6
1,435 Views
Last Modified: 2012-06-21
Hello 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

        'If Directory.Exists(ExportPath) = False Then
        '    Directory.CreateDirectory(Request.PhysicalApplicationPath)
        'End If

        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


I am really stuck, any help appreciated..
0
Comment
Question by:Mosquitoe
  • 2
  • 2
6 Comments
 
LVL 3

Expert Comment

by:TwoSide
ID: 10652155
I don't know if that can help you but....

here is the code I'v use yesterday to export a report to a pdf format

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared

'//--- Your code...

'//--- Take note that the report data source have been initialise before the call of this function!
Private Sub ExportToPDF(ByVal rpt As rptReception, ByVal sFileName As String)
        Try
            Dim crReportDocument As ReportDocument
            Dim crExportOptions As ExportOptions
            Dim crDiskFileDestinationOptions As DiskFileDestinationOptions

            crReportDocument = rpt

            crDiskFileDestinationOptions = New DiskFileDestinationOptions

            crDiskFileDestinationOptions.DiskFileName = Environment.GetEnvironmentVariable("TEMP") & "\" & sFileName

            crExportOptions = crReportDocument.ExportOptions
            With crExportOptions
                .DestinationOptions = crDiskFileDestinationOptions
                .ExportDestinationType = ExportDestinationType.DiskFile
                .ExportFormatType = ExportFormatType.PortableDocFormat
            End With

            crReportDocument.Export()
        Catch oEx As System.Exception
            MessageBox.Show(oEx.Message)
        End Try
    End Sub

TwoSide
0
 

Author Comment

by:Mosquitoe
ID: 10652226

Thanks for you reply - Your code looks a lot like what I have tried to do.  My database connection is taken care of at the report level, I do not have to programmically re-connect.  I can view the report in the browser but when I attempt to export it to another file format, this is where I get the : Error in File c\...  Operation not yet implemented.  To me it looks like there is some type of issue with the cr9 report - but I can't figure out what??  This was working last week with cr v8.5..?
0
 

Author Comment

by:Mosquitoe
ID: 10657446
..still hoping somebody has an idea of how I can solve this... :(
0
 
LVL 3

Accepted Solution

by:
TwoSide earned 500 total points
ID: 10657543
Like you said, that's seem to be an issue with version 9 of CR.

I think that Crystal Decision can help you to resolve it!

Do you know that with crystal report, you got answered by email support!
Go on there web site at this page:
http://support.businessobjects.com/support/answers.asp?ref=default.asp_selectlist
Click on next button and follow the instruction...

I hope that can help you!
TwoSide
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question