Hi!
I would like to export to a csv file the content of a gridview in WPF. Which is the best and efficient way to do it?
Thanks!
Hi!
I would like to export to a csv file the content of a gridview in WPF. Which is the best and efficient way to do it?
Thanks!
Use the FileHelpers component to generate a CSV or simply use a StringBuilder instance to iterate through the contents of the columns in the WPF gridview, in similar pseudocode it would be like this.
StringBuilder sb = new StringBuilder(); foreach row in grid foreach col in grid sb.Append(col + ", "); end foreach sb.Append(Environment.NewLine); end foreach // Write out the StringBuilder instance to File
The above pseudocode iterates each row and each column, tacking on a delimiter for each column by using a comma.