private void ConvertCSV_Button_Click(object sender, RoutedEventArgs e)
{
// Write sample data to CSV file
using (CsvFileWriter writer = new CsvFileWriter("C:\\Users\\stagiaire\\Desktop\\WriteTest.csv"))
{
for (int i = 0; i < DGImpulse.Items.Count-1; i++)
{
CsvRow row = new CsvRow();
for (int j = 0; j < #I need the number of column here (it's currently 4)#; j++)
row.Add(#I need the element of my row here, like Element of the Cell1, etc#);
writer.WriteRow(row);
}
}
}
我在C#WPF中
答案 0 :(得分:0)
请参阅以下博文。
如何从WPF中的DataGrid导出数据: https://blog.magnusmontin.net/2013/09/29/export-data-from-a-datagrid/
它应包含将DataGrid
中显示的数据导出到CSV文件所需的所有信息。