### Export TableView to CSV file

To export a TableView to a CSV file, use the SaveCSV method from the jStringUtils library.
Example Subroutine using SaveCSV method
' Export TableView to csv format.
' Parameter Tableview
' Parameter CSV Filename
' Example exportTableViewToCSV(tableview1, "1.csv")
`Sub exportTableViewToCSV(tv As TableView, filename As String)
Dim su As StringUtils
Dim l As List
l.Initialize
For y = 0 To tv.Items.Size - 1
tv.SelectedRow = y
Dim Row() As Object = tv.SelectedRowValues
Dim NRow(Row.Length) As String
For x = 0 To Row.Length - 1
NRow(x) = Row(x)
l.Add(NRow)
Next
Next
Try
su.SaveCSV(File.DirApp, filename, ",", l)
Catch
Log(LastException.Message)
End Try
End Sub`
Export Subroutine using SaveCSV2 method
' Export tableview to csv format with column header. Uses jStringUtils Library.
' Parameter Tableview
' Parameter CSV Filename
`Sub exportTableViewToCSV2(tv As TableView, filename As String)
Dim su As StringUtils
Dim l As List
l.Initialize
For y = 0 To tv.Items.Size - 1
tv.SelectedRow = y
Dim Row() As Object = tv.SelectedRowValues
Dim NRow(Row.Length) As String
For x = 0 To Row.Length - 1
NRow(x) = Row(x)
l.Add(NRow)
Next
Next
Dim ch As List
ch.Initialize
For i = 0 To tv.ColumnsCount - 1
ch.Add(tv.GetColumnHeader(i))
Next
Try
su.SaveCSV2(File.DirApp, filename, ",", l, ch)
Catch
Log(LastException.Message)
End Try
End Sub`

Changed: , Category: TableView, File: T6C259M1881.htm, ID: 1881