Solved

Report Document export not working...

Posted on 2004-03-22
6
1,443 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Is Your Team Achieving Their Full Potential?

74% of employees feel they are not achieving their full potential. With Linux Academy, not only will you strengthen your team's core competencies but also their knowledge of of the newest IT topics.

With new material every week, we'll make sure that you stay ahead of the game.

Question has a verified solution.

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

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

687 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