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

I checked briefly through your code and the problem seemed to be that diskDestination.
I'm not sure since I'm not a pro. In my point of view, HTML is not only a file, it contains many objects and they're in a folder. Then when you creating a file but not a file and a folder, things might not working your way.

        Try
            Dim selectedReport As New ReportClass
            Dim CrFormatTypeOptions As New HTMLFormatOptions
            CrFormatTypeOptions.HTMLBaseFolderName = "d:\test"
            CrFormatTypeOptions.HTMLFileName = "htmlformat.htm"
            Dim CrExportOptions As ExportOptions
            CrExportOptions = myReportDocument.ExportOptions
            With CrExportOptions
                .ExportFormatType = ExportFormatType.HTML40
                .FormatOptions = CrFormatTypeOptions
            End With
            myReportDocument.Export()
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try

Thanks you very much dear Eternal Newbie ... Its work perfectly fine ..

would give me any idea for .TXT

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.