邮件地址以CSV格式强制第二条记录(DevExpress控件)

时间:2010-04-20 19:01:36

标签: vb.net csv devexpress xtragrid

我的DevExpress CSV导出每条记录有两行。

Rank Score,Prog.,Full Address               
63.30     ,JIW  ,1234 Whispering Pines Dr   
          ,     ,Sometown MI 48316
62.80     ,JIW  ,9876 Beagle Dr             
          ,     ,Sometown Twp MI 48382

我想将其更改为一行,因为我想进行Word Merge。 (除非Word可以将这两行重新合并在一起,但我不能做到这一点)

DevExpress XtraGrid ExportToText 是否允许这样做?

XtraGrid正在使用MemoEdit,并使用以下代码进行初始化(注意ControlChars.NewLine):

Public ReadOnly Property FullAddress() As String
    Get
        Dim strAddress As System.Text.StringBuilder = New StringBuilder()
        If Not IsNullEntity Then
            strAddress.Append(Line1 + ControlChars.NewLine)
            If Not Line2 Is Nothing AndAlso Me.Line2.Length > 0 Then
                strAddress.Append(Line2 + ControlChars.NewLine)
            End If
            If Not Line3 Is Nothing AndAlso Me.Line3.Length > 0 Then
                strAddress.Append(Line3 + ControlChars.NewLine)
            End If
            strAddress.Append(String.Format("{0} {1} {2}", City, RegionCode, PostalCode))
            If Me.Country <> "UNITED STATES" Then
                strAddress.Append(ControlChars.NewLine + Me.Country)
            End If
        End If
        Return strAddress.ToString
    End Get
End Property

以下是导出为CSV代码:

    Dim saveFile As New SaveFileDialog
    With saveFile
        '.InitialDirectory = ClientManager.CurrentClient.Entity.StudentPictureDirectory
        .FileName = "ApplicantList.csv"
        .CheckPathExists = True
        .CheckFileExists = False
        .Filter = "All Files (*.*)|*.*"
    End With
    If saveFile.ShowDialog() = Windows.Forms.DialogResult.OK Then
        Dim PrintingTextExportOptions As New DevExpress.XtraPrinting.TextExportOptions(",", Encoding.ASCII)
        PrintingTextExportOptions.QuoteStringsWithSeparators = True
        ApplicantRankListViewsGridControl.ExportToText(saveFile.FileName, PrintingTextExportOptions)
    End If

1 个答案:

答案 0 :(得分:2)

我发现http://www.filehelpers.net/是将文件导出/导入不同格式的绝佳工具。希望这会帮助你。