Академический Документы
Профессиональный Документы
Культура Документы
Dim ds As New DataSet Dim da As New SqlDataAdapter ds = connectSql.RunSQLReturnDS(strquery) dt = ds.Tables(0) Dim rptshow As Boolean If dt.Rows.Count > 0 Then Dim rpdoc As New ReportDocument() Dim strpath = Application.StartupPath Dim strReportPath As String = strpath + "\Crystal Reports\Sales Report\" & strReportName & ".rpt" rpdoc.Load(strReportPath) rpdoc.SetDataSource(dt) Me.CrystalReportViewer1.ReportSource = rpdoc 'rptshow = True 'Me.Text = strReportPath 'Me.Show() Me.CrystalReportViewer1.Refresh() 'export code start here Dim CrExportOptions As ExportOptions Dim CrDiskFileDestinationOptions As New _ DiskFileDestinationOptions() Dim CrFormatTypeOptions As New PdfRtfWordFormatOptions() CrDiskFileDestinationOptions.DiskFileName = strpath + "\Crystal Reports\Sales Report\" & strReportName & ".pdf" CrExportOptions = rpdoc.ExportOptions With CrExportOptions .ExportDestinationType = ExportDestinationType.DiskFile .ExportFormatType = ExportFormatType.PortableDocFormat .DestinationOptions = CrDiskFileDestinationOptions .FormatOptions = CrFormatTypeOptions End With rpdoc.Export() Else RadMessageBox.Show("No Data Found") Me.Close() rptshow = False End If Catch ex As Exception RadMessageBox.Show(ex.Message.ToString()) End Try End Function