it-partners Home   |  Site Map
 Support
       Bits and Pieces

Export itGrid contents to a file

Here are several examples using the itGrid.TextMatrix method to export text to a file.

' This exports non-fixed cells using vbCrLf as the row delimiter and vbKeyTab as the
' column delimiter (vbKeyTab is the default if not specified)

Open App.Path & "\test.txt" For Output As #1
Print #1, itGrid1.TextMatrix(-1, -1, , , vbCrLf)
Close #1

' This exports all cells
Open App.Path & "\test.txt" For Output As #1
Print #1, itGrid1.TextMatrix(0, 0, itGrid1.Rows - 1, itGrid1.Cols - 1, vbCrLf)
Close #1

' This exports all cells using a custom column delimiter
Open App.Path & "\test.txt" For Output As #1
Print #1, itGrid1.TextMatrix(0, 0, itGrid1.Rows - 1, itGrid1.Cols - 1, vbCrLf, "|")
Close #1