Solved

Report Document export not working...

Posted on 2004-03-22
6
1,427 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

762 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now