Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
The Below Code i have used to Export for CSV Format
<  Dim FileFullPath As String = System.IO.Path.GetFullPath(psPhysicalFileName)
        Dim FileExtension As String = System.IO.Path.GetExtension(FileFullPath)
 
        ' Determine the original file name.
        ' When the download window opens, show the original file name in the File Name textbox.
        Dim OriginalFileName As String = System.IO.Path.GetFileName(psOriginalFileName)
 
        Dim FileType As String = String.Empty
        Dim FileContentType As String = String.Empty
 
        Try
            If Not IsDBNull(FileExtension) Then
                FileType = LCase(FileExtension)
 
                ' Determine the content type based on the file extension.
                Select Case FileType
                    Case ".html"
                        FileContentType = "text/HTML"
                    Case ".gif"
                        FileContentType = "image/GIF"
                    Case "jpeg"
                        FileContentType = "image/JPEG"
                    Case ".txt"
                        FileContentType = "text/plain"
                    Case ".csv"
                        FileContentType = "text/csv"
                End Select
            End If
 
            ' The dialog should show the original file name.
            If (forceDownload) Then
                Response.AppendHeader("content-disposition", _
                                      "attachment; filename=" & OriginalFileName)
            End If
 
            ' Sent the content type so that browser will know how to handle the file.
            If FileType <> String.Empty Then
                Response.ContentType = FileContentType
            End If
 

            ' Initiate the download
            Response.WriteFile(FileFullPath.ToString())
 
            ' Show the link to all the user to download the file if necessary.
            If Not LabelMessage Is Nothing Then
                lblMessage.Text = "You have downloaded the file " & OriginalFileName
 
            End If
 
            Response.End()
 
        Catch oEx As Exception
 
            ' Show the error message if needed.
            If Not LabelMessage Is Nothing Then
                lblMessage.Text = "Error downloading the file " & OriginalFileName
            End If
 
        Finally
            ' Clean up objects
        End Try
>
 
In one cell,i get output like
"Left Message – VM" Instead of "Left Message - VM"
Thanks in Advance
Posted 30-Aug-12 0:03am
rajrprk656
Edited 30-Aug-12 0:05am
(no name)5.6K
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 490
1 Maciej Los 305
2 Richard MacCutchan 270
3 Mathew Soji 220
4 BillWoodruff 210
0 OriginalGriff 8,834
1 Sergey Alexandrovich Kryukov 7,477
2 DamithSL 5,689
3 Maciej Los 5,329
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web04 | 2.8.1411028.1 | Last Updated 30 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100