-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: mrp
Message 2 in Discussion

hi,    Private Sub exportthereport(ByVal mychoice As selecttheformat)         Dim 
exportOpts As New ExportOptions
        Dim diskOpts As New DiskFileDestinationOptions
        'Dim FormatOpts As ExportOptions 
        Dim oRpt As New mycountry         Dim crLogonInfo As 
CrystalDecisions.Shared.TableLogOnInfo
        crLogonInfo = oRpt.Database.Tables(0).LogOnInfo
        crLogonInfo.ConnectionInfo.ServerName = "192.168.0.3"
        crLogonInfo.ConnectionInfo.DatabaseName = "aims"
        crLogonInfo.ConnectionInfo.UserID = "sa"
        crLogonInfo.ConnectionInfo.Password = "sa123"         
oRpt.Database.Tables(0).ApplyLogOnInfo(crLogonInfo) 
        exportOpts = oRpt.ExportOptions 
        Dim path As String = "d:\daytoday\pt\"
        Dim fname As String         Select Case mychoice             Case 
selecttheformat.Excel  ''EXCEL
                Dim FormatOpts As New ExcelFormatOptions
                exportOpts.ExportFormatType = ExportFormatType.Excel
                exportOpts.FormatOptions = FormatOpts
                fname = path & "Filename.xls"
            Case selecttheformat.Word  ''WORD /RTF
                Dim FormatOpts As New PdfRtfWordFormatOptions
                exportOpts.ExportFormatType = ExportFormatType.RichText
                exportOpts.FormatOptions = FormatOpts
                fname = path & "Filename.doc"
            Case selecttheformat.HTML  ''HTML ''NOT WORKING
                Dim FormatOpts As New HTMLFormatOptions
                exportOpts.ExportFormatType = ExportFormatType.HTML40
                exportOpts.FormatOptions = FormatOpts
                fname = path & "Filename.html"
            Case selecttheformat.PDF  ''PDF
                Dim FormatOpts As New PdfRtfWordFormatOptions
                exportOpts.ExportFormatType =
ExportFormatType.PortableDocFormat
                exportOpts.FormatOptions = FormatOpts
                fname = path & "Filename.pdf"
            Case selecttheformat.Word
                Dim FormatOpts As New PdfRtfWordFormatOptions
                exportOpts.ExportFormatType = ExportFormatType.RichText
                exportOpts.FormatOptions = FormatOpts
                fname = path & "Filename.doc"
        End Select         If mychoice <> 0 Then
            exportOpts.ExportDestinationType = ExportDestinationType.DiskFile
        Else
            exportOpts.ExportDestinationType =
ExportDestinationType.MicrosoftMail
        End If           diskOpts.DiskFileName = fname         
exportOpts.DestinationOptions = diskOpts
        oRpt.Export() 
        Response.ClearContent()
        Response.ClearHeaders()
        Dim thetype As String
        Select Case mychoice
            Case selecttheformat.Excel
                thetype = Rnd(1) & ".xls"
                Response.ContentType = "application/xls"
            Case selecttheformat.Word
                thetype = Rnd(1) & ".doc"
                Response.ContentType = "application/doc"
            Case selecttheformat.HTML     ''NOT WORKING
                thetype = Rnd(1) & ".html"
                Response.ContentType = "application/html"
            Case selecttheformat.PDF
                thetype = Rnd(1) & ".pdf"
                Response.ContentType = "application/pdf"         End Select
        Response.AppendHeader("ContentType", "application/octet-stream")
        Response.AppendHeader("Content-Disposition", "attachment; filename=" &
thetype & "")         Response.WriteFile(fname)         Response.Flush()
        Response.Close()         System.IO.File.Delete(fname)
    End Sub     hope it helps    

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/BDotNet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to