Results 1 to 2 of 2

Thread: Spanish language text export

Hybrid View

  1. #1

    Thread Starter
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536

    Spanish language text export

    Hi,

    I have a ListView which represents a shopping list and contains a number of items. I also have an <Export> button which, when clicked, writes all the items in the listview to a CSV file.

    My problem is that when I test this on a Spanish Win2000 PC the displayed text in the list is output incorrectly.

    e.g.
    "Protección de carcasa"

    is output as

    "Protección de carcasa"



    Does anybody have any suggestions?


    VB Code:
    1. Private Sub cmdExport_Click(ByVal sender As System.Object, _
    2.                                 ByVal e As System.EventArgs) _
    3.                                                     Handles cmdExport.Click
    4.         'Export the Shopping List in CSV format.
    5.         Dim str As String
    6.         Dim int As Integer
    7.  
    8.  
    9.         If SaveFileDialog1.ShowDialog() = DialogResult.OK Then
    10.             Dim strFile As String = SaveFileDialog1.FileName
    11.             If strFile <> "" Then
    12.                 Dim swExport As StreamWriter
    13.                 Try
    14.                     Dim utf8 As New System.Text.UTF8Encoding()
    15.                     swExport = New StreamWriter(New FileStream(strFile, _
    16.                                                 FileMode.OpenOrCreate), utf8)
    17.                     '"ProductCode,Description,LoopA,LoopB,LoopC,LoopD,Total"
    18.                     swExport.WriteLine(GetText("exportFileHeader"))
    19.  
    20.                     Dim ShoppingListItem As ListViewItem
    21.                     For Each ShoppingListItem In lvwShoppingList.Items
    22.                         str = ""
    23.                         For int = 0 To 6
    24.                             str &= ShoppingListItem.SubItems(int).Text & ","
    25.                         Next int
    26.                         'Remove the trailing "," from the string.
    27.                         str = Mid(str, 1, str.Length - 1)
    28.                         swExport.WriteLine(str)
    29.                     Next ShoppingListItem
    30.  
    31.                 Finally
    32.                     swExport.Close()
    33.                 End Try
    34.             End If
    35.         End If
    36.     End Sub
    This world is not my home. I'm just passing through.

  2. #2

    Thread Starter
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536
    Ha!

    Got it working with a slight change to the StreamWriter constructor.


    VB Code:
    1. Private Sub cmdExport_Click(ByVal sender As System.Object, _
    2.                                 ByVal e As System.EventArgs) _
    3.                                                     Handles cmdExport.Click
    4.         'Export the Shopping List in CSV format.
    5.         Dim str As String
    6.         Dim int As Integer
    7.  
    8.  
    9.         If SaveFileDialog1.ShowDialog() = DialogResult.OK Then
    10.             Dim strFile As String = SaveFileDialog1.FileName
    11.             If strFile <> "" Then
    12.                 Dim swExport As StreamWriter
    13.                 Try
    14.                     swExport = New StreamWriter(strFile, False, _
    15.                                                 System.Text.Encoding.Unicode)
    16.                     '"ProductCode,Description,LoopA,LoopB,LoopC,LoopD,Total"
    17.                     swExport.WriteLine(GetText("exportFileHeader"))
    18.  
    19.                     Dim ShoppingListItem As ListViewItem
    20.                     For Each ShoppingListItem In lvwShoppingList.Items
    21.                         str = ""
    22.                         For int = 0 To 6
    23.                             str &= ShoppingListItem.SubItems(int).Text & ","
    24.                         Next int
    25.                         'Remove the trailing "," from the string.
    26.                         str = Mid(str, 1, str.Length - 1)
    27.                         swExport.WriteLine(str)
    28.                     Next ShoppingListItem
    29.  
    30.                 Finally
    31.                     swExport.Close()
    32.                 End Try
    33.             End If
    34.         End If
    35.     End Sub
    This world is not my home. I'm just passing through.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width