Public Sub ReportDocumentDetails(ByVal rptPath As String, ByVal reportname As String, ByVal dtReport As DataTable, _
ByVal arListName As System.Collections.ArrayList, ByVal arListValue As System.Collections.ArrayList)
Dim rptViewer As New CrystalDecisions.Windows.Forms.CrystalReportViewer()
Dim ds As DatasetReport = New DatasetReport
Dim rptdoc As CrystalDecisions.CrystalReports.Engine.ReportDocument = New CrystalDecisions.CrystalReports.Engine.ReportDocument
rptdoc.Load(rptPath)
rptdoc.SetDataSource(CType(dtReport, DataTable))
If (arListName.Count = arListValue.Count) Then
For i As Integer = 0 To arListName.Count - 1
rptdoc.SetParameterValue(arListName(i).ToString, arListValue(i))
Next
End If
Dim objExOpt As CrystalDecisions.Shared.ExportOptions
Dim objDiskOpt As New CrystalDecisions.Shared.DiskFileDestinationOptions
objDiskOpt.DiskFileName = "F:\nath\" & reportname & ".pdf"
objExOpt = rptdoc.ExportOptions
objExOpt.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile
objExOpt.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.PortableDocFormat
objExOpt.DestinationOptions = objDiskOpt
rptdoc.Export(objExOpt)
rptdoc.Close()
End Sub
No comments:
Post a Comment