1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| SW = New StreamWriter(FileName) 'SB_BUG:Lors de l'ouverture avec Excel, pb encodage (SYLK)
RaiseEvent StartProcess(_DataTable, New StepEvents(FileName, NombreDEtapes, 0, MesureDuree.ElapsedMilliseconds))
'
' Ecriture des noms des en-têtes
'
If FirstLineIsColumnName Then
Dim CSVLine As String = ""
For i As Integer = 0 To _DataTable.Columns.Count - 1
CSVLine = CSVLine & Separator & _DataTable.Columns(i).Caption
Next
SW.WriteLine(CSVLine.Substring(1))
End If
RaiseEvent NewStep(_DataTable, New StepEvents(FileName, NombreDEtapes, 1, MesureDuree.ElapsedMilliseconds))
'
' Ecriture des données
'
For j As Integer = 0 To _DataTable.Rows.Count - 1
Dim CSVLine As String = ""
For i As Integer = 0 To _DataTable.Rows(j).ItemArray.Length - 1
CSVLine = CSVLine & Separator & _DataTable.Rows(j).Item(i).ToString
Next
SW.WriteLine(CSVLine.Substring(1))
RaiseEvent NewStep(_DataTable, New StepEvents(FileName, NombreDEtapes, j + 1, MesureDuree.ElapsedMilliseconds))
Next
SW.Close() |
Partager