Friends .. how my code working fine with two buttons (PDF and RTF) but the last portion for HTML converting its not working .. please help
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 = "d:\test\check.pdf"
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
Private Sub btnHtml_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHtml.Click
Try
Dim CrExportOptions As ExportOptions
Dim CrDiskFileDestinationOptions As New DiskFileDestinationOptions()
Dim CrFormatTypeOptions As New PdfRtfWordFormatOptions
CrDiskFileDestinationOptions.DiskFileName = "d:\test\richtext.rtf"
CrExportOptions = myReportDocument.ExportOptions
With CrExportOptions
.ExportDestinationType = ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType.RichText
.DestinationOptions = CrDiskFileDestinationOptions
.FormatOptions = CrFormatTypeOptions
End With
myReportDocument.Export()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub btnCsv_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCsv.Click
Try
Dim CrExportOptions As ExportOptions
Dim CrDiskFileDestinationOptions As New DiskFileDestinationOptions()
Dim CrFormatTypeOptions As New CrystalDecisions.Shared.HTMLFormatOptions()
CrDiskFileDestinationOptions.DiskFileName = "d:\test\textformat.html"
CrExportOptions = myReportDocument.ExportOptions
With CrExportOptions
.ExportDestinationType = ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType.HTML40
.DestinationOptions = CrDiskFileDestinationOptions
.FormatOptions = CrFormatTypeOptions
End With
myReportDocument.Export()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
End Class