邮寄地址强制 CSV 中的第二条记录(DevExpress 控件)

发布于 2024-08-29 13:25:38 字数 2045 浏览 5 评论 0原文

我的 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 可以将这两行合并在一起,我不认为它可以做到)

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

My DevExpress CSV export has two lines per record.

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

I would like to change it to one line because I want to do a Word Merge. (Unless Word can merge these two lines back together, which I do not thing it can do)

Does the DevExpress XtraGrid ExportToText allow for this?

A MemoEdit is being used by the XtraGrid and is initialized using the following code (Noticed the 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

Here is the export to CSV code:

    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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

倒数 2024-09-05 13:25:38

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

I have found http://www.filehelpers.net/ to be a great tool for exporting/importing files into different formats. Hope this helps you out.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文