XML Export Capabilities RRS feed

  • Question

  • User1610691276 posted

    I'm fairly inexperienced in Crystal Reports.  I updated a CR report one time 10 years ago.  That's about the extent of my knowledge.

    A quick Google on "crystal reports versions" returns the following version numbers - "9, 10, 11, 2008".

    Does Crystal Reports support XML export on all of its report types?  If so then from which version has Crystal Reports supported this functionality?


    Saturday, May 29, 2010 3:24 PM

All replies

  • User-1659704165 posted


    I think from Crystal Reports 9.0


    For Learning example I have seen(some where and stored it in my system) this code i never used

    sahrining it.

    Well first of all I would not use the CRAXDRT object.
    Here is some code that I use with cr9...


    You can use a ADO or SQL connection...

    Imports CrystalDecisions.CrystalReports.Engine
    Imports CrystalDecisions.ReportSource
    Imports CrystalDecisions.Shared
    Imports ADODB                                 '<---- Access
    Imports System.Data.SqlClient            '<---- SQL

        Public myReport As New ReportDocument        'Gobal Report Doc
        Public sAppPath = Application.StartupPath        'Application Directory Main Path
        Public sReportPath = "\Reports\"                     'Reports Directory Path

       '**** Server Connection Vars *********
        Public sDBServer As String = "MYSERVER"
        Public sUSERid As String = "MYUSER"
        Public sDBName As String = "MYDATABASE"
        Public sDBPass As String = ""
        Public Con As OleDb.OleDbConnection      '<--- for Access
        Public Connect As SqlConnection             '<--- for msSQL
        Public sSQL As String

        Private Sub GetReportConnection(ByVal myReport)
            ' Objects used to set the proper database connection information
            Dim tbCurrent As CrystalDecisions.CrystalReports.Engine.Table
            Dim tliCurrent As CrystalDecisions.Shared.TableLogOnInfo

                ' Load the report
                myReport.Load(sAppPath & sReportPath & sReportName, CrystalDecisions.[Shared].OpenReportMethod.OpenReportByTempCopy)
                ' Set the connection information for all the tables used in the report
                For Each tbCurrent In myReport.Database.Tables
                    tliCurrent = tbCurrent.LogOnInfo
                    With tliCurrent.ConnectionInfo
                        .ServerName = sDBServer
                        .UserID = sUSERid
                        .Password = ""
                        .DatabaseName = sDBName
                    End With
                Next tbCurrent
            Catch Exp As LoadSaveReportException
                MsgBox("Incorrect path for loading report.", _
                        MsgBoxStyle.Critical, "Load Report Error")
            Catch Exp As Exception
                MsgBox(Exp.Message & "   in GetReportConnection Procedure", MsgBoxStyle.Critical, "General Error")
            End Try
        End Sub


      Private Sub ExptReport(ByVal myReport)
           Dim myExportOptions As New CrystalDecisions.Shared.ExportOptions
           Dim myDiskFileDesOptions As New CrystalDecisions.Shared.DiskFileDestinationOptions

                              myDiskFileDesOptions.DiskFileName = sAppPath & sReportPath &  "MYXMLFILE.html"
                                myExportOptions = myReport.ExportOptions
                                Dim myFormatTypOpt As New CrystalDecisions.Shared.HTMLFormatOptions
                                With myFormatTypOpt
                                    .HTMLBaseFolderName = sReportPath
                                    .HTMLFileName = myDiskFileDesOptions.DiskFileName
                                    .HTMLEnableSeparatedPages = True
                                    .HTMLHasPageNavigator = True
                                End With
                                With myExportOptions
                                    .ExportDestinationType = CrystalDecisions.[Shared].ExportDestinationType.DiskFile
                                    .ExportFormatType = CrystalDecisions.[Shared].ExportFormatType.HTML40
                                    .DestinationOptions = myDiskFileDesOptions
                                    .FormatOptions = myFormatTypOpt
                                End With
                    Catch Exp As ExportException
                        MsgBox("Incorrect path for saving report.", _
                                MsgBoxStyle.Critical, "Load Report Error")
                    Catch Exp As System.Reflection.TargetInvocationException
                        'Jump over this error
                    Catch Exp As Exception
                        MsgBox(Exp.Message & " in CheckReportList", MsgBoxStyle.Critical, "General Error")
                    End Try
                End If
          End Sub

    'SAMPLE for PASSING Parameters

      Private Sub Parmas(ByVal myReport) 'FOR Dates and Ranges
            ' Objects used to set the parameters in the report
            Dim pvCollection As New ParameterValues
            Dim pdvID As New ParameterDiscreteValue
            Dim pdvStartName As New ParameterDiscreteValue
            Dim pdvEndName As New ParameterDiscreteValue
            Dim pdvPageCount As New ParameterDiscreteValue
                    '********************************* ID **********************************
                    ' Set the discreet value to the Start Date.
                    pdvID.Value = sdbID
                    ' Add it to the parameter collection.
                    ' Apply the current parameter values.

                    '********************************* Start Date **********************************
                    pdvStartName.Value = sDBStartDate
                    myReport.DataDefinition.ParameterFields("Start Date").ApplyCurrentValues(pvCollection)

                    '********************************* End Date **********************************
                    pdvEndName.Value = sDBEndDate
                    myReport.DataDefinition.ParameterFields("End Date").ApplyCurrentValues(pvCollection)
                    '********************************* Page Count **********************************
                    pdvPageCount.Value = iPageCount + 1
                    myReport.DataDefinition.ParameterFields("Page Count").ApplyCurrentValues(pvCollection)
             Catch Exp As ParameterFieldException
                MsgBox("Incorrect Parameter Field." & vbNewLine & "In Parmas Procedure Code", _
                        MsgBoxStyle.Critical, "Load Report Error")
            Catch Exp As InvalidArgumentException
                MsgBox(Exp.Message & vbNewLine & "In Parmas Procedure Code", MsgBoxStyle.Critical, "General Error")
            Catch Exp As Exception
                MsgBox(Exp.Message & vbNewLine & "In Parmas Procedure Code", MsgBoxStyle.Critical, "General Error")
            End Try
        End Sub

    Monday, May 31, 2010 11:29 AM