0

I am using this code to to generate a crystal report from aa sql string that i construct using a supplied table name and some column names in txtSQL.This code contains functionality to export to ms word.However when the save dialog comes up and the user enters the intended filename.and saves the document.when the user attempts to open the document they have to use"open with" because the save dialog does not add an extension to the file so my question is how can i add an extension for tthe user programmatically.This is my first time using save dialog

Dim rpt As New MembersReport()
            sfdSaveMe.ShowDialog()
            Dim strExportFile As String = sfdSaveMe.FileName

            Dim sql_personnel As String = procesSQL(txtSQL.Text, cmbTableName.Text)
            Dim dt As New DataTable
            dt = MyFormz.cl_Class.SelectRows_B(sql_personnel, "CMS2010051005")

            ReportTitle = rpt.ReportDefinition.Sections(0).ReportObjects("txtReportTitle")
            ReportTitle.Text = strTitle

            rpt.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile
            rpt.ExportOptions.ExportFormatType = ExportFormatType.WordForWindows
            Dim objOptions As DiskFileDestinationOptions = New DiskFileDestinationOptions()
            objOptions.DiskFileName = strExportFile
            rpt.ExportOptions.DestinationOptions = objOptions

            rpt.SetDataSource(dt)
            rpt.Export()
            CrystalReportViewer1.ReportSource = rpt
            objOptions = Nothing
            rpt = Nothing
3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by tendaimare
1

To add a filter, you would simply do this:

sfdSaveMe.Filter = "MS Word (*.doc)|*.doc|All files (*.*)|*.*"

The string is comprised of the following:
Desscription|extention|

then to add more you just keep adding more.
Desscription1|extention1|Desscription2|extention2|Desscription3|extention3|

Edited by _KoBE_: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.