文件名称:wpf datagrid数据导出到execl
文件大小:307KB
文件格式:RAR
更新时间:2018-12-03 04:53:33
wpf datagrid execl
private void daochu_Click(object sender, RoutedEventArgs e) { System.Windows.Controls.DataGrid DataGrid = dataGrid1; string file = "C:Users\\Administrator\\Desktop\\qb"; Export(DataGrid, file); } public static void Export(System.Windows.Controls.DataGrid dataGrid, string _fileName) { System.Data.DataTable dt = new System.Data.DataTable(); for (int i = 0; i < dataGrid.Columns.Count; i++) { if (dataGrid.Columns[i].Visibility == System.Windows.Visibility.Visible)//只导出可见列 { dt.Columns.Add(dataGrid.Columns[i].Header.ToString());//构建表头
【文件预览】:
execl_test
----execl_test.sln(872B)
----execl_test()
--------bin()
--------App.xaml(321B)
--------obj()
--------Hellow.cs(286B)
--------App.xaml.cs(306B)
--------execl_test.csproj(5KB)
--------MainWindow.xaml(1KB)
--------Properties()
--------MainWindow.xaml.cs(6KB)
----execl_test.suo(26KB)