Dear Friends Can any body help me .. i want to export my crystal report to a text file, here is my code. If its not good then please give any other perfect refrence thank you
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports System.Diagnostics
Imports System.IO
Public Class Form1
Dim myReportDocument As New ReportDocument
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
myReportDocument.Load("d:\test\S111.rpt")
CrystalReportViewer1.ReportSource = myReportDocument
CrystalReportViewer1.Refresh()
End Sub
Private Sub BtnText_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnText.Click
Try
Dim CrExportOptions As ExportOptions
Dim CrDiskFileDestinationOptions As New DiskFileDestinationOptions()
Dim CrFormatTypeOptions As New PdfRtfWordFormatOptions
CrDiskFileDestinationOptions.DiskFileName = "c:\check.txt"
CrExportOptions = myReportDocument.ExportOptions
With CrExportOptions
.ExportDestinationType = ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType.PortableDocFormat
.DestinationOptions = CrDiskFileDestinationOptions
.FormatOptions = CrFormatTypeOptions
End With
myReportDocument.Export()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
End Class