Hi all,

Would you please help me to find a way that I can open an external crystal report in my application without creating a new report. I actually wanted the application to export the report to a PDF which I know the methods to do it. What I am searching for is the way to open the external report which was built in crystal report 9.0. I had searched so many tutorials where I found only the methods to create a new report in my application and then exporting the same. But none of it telling any way to open an external report. So kinldy help me with some solutions to solve it out. I am using VB.net and the developement tool is Visual Studio 2003.

Thank you all,

I got the solution.

Try
            Dim rpt As New ReportDocument
            rpt.Load("Your report location")
            Dim exportOpts As New ExportOptions
            Dim diskOpts As New DiskFileDestinationOptions
            Dim pdfFormatOpts As New PdfRtfWordFormatOptions

            exportOpts = rpt.ExportOptions
            exportOpts.FormatOptions = pdfFormatOpts
            exportOpts.ExportFormatType = ExportFormatType.PortableDocFormat
            exportOpts.ExportDestinationType = ExportDestinationType.DiskFile
            diskOpts.DiskFileName = "PDF saving location\[B]filename.pdf[/B]"
            exportOpts.DestinationOptions = diskOpts
            rpt.Export()
            
        Catch ex As Exception

            MsgBox(ex.Message)

        End Try

It worked fine for mel. Please note that you have to add crystal references in your solution to make these codes work.

Add these references to your solution:

CrystalDecisions.CrystalReports.Engine
CrystalDecisions.Shared
CrystalDecisions.Windows.Forms

and import the same in your vb file

Thats it.....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.