wpf datagrid数据导出到execl

上传者: qbhainan | 上传时间: 2019-12-21 20:28:44 | 文件大小: 307KB | 文件类型: rar
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());//构建表头

文件下载

资源详情

[{"title":"( 37 个子文件 307KB ) wpf datagrid数据导出到execl","children":[{"title":"execl_test","children":[{"title":"execl_test.sln <span style='color:#111;'> 872B </span>","children":null,"spread":false},{"title":"execl_test","children":[{"title":"bin","children":[{"title":"Debug","children":[{"title":"execl_test.pdb <span style='color:#111;'> 31.50KB </span>","children":null,"spread":false},{"title":"execl_test.vshost.exe.manifest <span style='color:#111;'> 490B </span>","children":null,"spread":false},{"title":"Book1.xls <span style='color:#111;'> 13.50KB </span>","children":null,"spread":false},{"title":"execl_test.exe <span style='color:#111;'> 18.50KB </span>","children":null,"spread":false},{"title":"execl_test.vshost.exe <span style='color:#111;'> 11.33KB </span>","children":null,"spread":false}],"spread":true}],"spread":true},{"title":"App.xaml <span style='color:#111;'> 321B </span>","children":null,"spread":false},{"title":"obj","children":[{"title":"x86","children":[{"title":"Debug","children":[{"title":"App.g.i.cs <span style='color:#111;'> 2.26KB </span>","children":null,"spread":false},{"title":"execl_test.pdb <span style='color:#111;'> 31.50KB </span>","children":null,"spread":false},{"title":"App.g.cs <span style='color:#111;'> 2.26KB </span>","children":null,"spread":false},{"title":"execl_test_MarkupCompile.i.cache <span style='color:#111;'> 277B </span>","children":null,"spread":false},{"title":"execl_test_MarkupCompile.cache <span style='color:#111;'> 276B </span>","children":null,"spread":false},{"title":"execl_test.Properties.Resources.resources <span style='color:#111;'> 180B </span>","children":null,"spread":false},{"title":"execl_test.exe <span style='color:#111;'> 18.50KB </span>","children":null,"spread":false},{"title":"execl_test.csproj.ResolveComReference.cache <span style='color:#111;'> 1019B </span>","children":null,"spread":false},{"title":"DesignTimeResolveAssemblyReferencesInput.cache <span style='color:#111;'> 6.69KB </span>","children":null,"spread":false},{"title":"execl_test.csproj.FileListAbsolute.txt <span style='color:#111;'> 1.14KB </span>","children":null,"spread":false},{"title":"MainWindow.g.cs <span style='color:#111;'> 4.68KB </span>","children":null,"spread":false},{"title":"execl_test.g.resources <span style='color:#111;'> 1.83KB </span>","children":null,"spread":false},{"title":"Interop.Microsoft.Office.Core.dll <span style='color:#111;'> 397.50KB </span>","children":null,"spread":false},{"title":"DesignTimeResolveAssemblyReferences.cache <span style='color:#111;'> 14.85KB </span>","children":null,"spread":false},{"title":"TempPE","children":[{"title":"Properties.Resources.Designer.cs.dll <span style='color:#111;'> 4.50KB </span>","children":null,"spread":false}],"spread":false},{"title":"MainWindow.g.i.cs <span style='color:#111;'> 4.68KB </span>","children":null,"spread":false},{"title":"Interop.Excel.dll <span style='color:#111;'> 1.03MB </span>","children":null,"spread":false},{"title":"MainWindow.baml <span style='color:#111;'> 1.60KB </span>","children":null,"spread":false},{"title":"execl_test.csproj.GenerateResource.Cache <span style='color:#111;'> 917B </span>","children":null,"spread":false}],"spread":false}],"spread":true}],"spread":true},{"title":"Hellow.cs <span style='color:#111;'> 286B </span>","children":null,"spread":false},{"title":"App.xaml.cs <span style='color:#111;'> 306B </span>","children":null,"spread":false},{"title":"execl_test.csproj <span style='color:#111;'> 5.32KB </span>","children":null,"spread":false},{"title":"MainWindow.xaml <span style='color:#111;'> 1.08KB </span>","children":null,"spread":false},{"title":"Properties","children":[{"title":"Resources.resx <span style='color:#111;'> 5.48KB </span>","children":null,"spread":false},{"title":"Settings.settings <span style='color:#111;'> 201B </span>","children":null,"spread":false},{"title":"AssemblyInfo.cs <span style='color:#111;'> 2.15KB </span>","children":null,"spread":false},{"title":"Settings.Designer.cs <span style='color:#111;'> 1.07KB </span>","children":null,"spread":false},{"title":"Resources.Designer.cs <span style='color:#111;'> 2.80KB </span>","children":null,"spread":false}],"spread":true},{"title":"MainWindow.xaml.cs <span style='color:#111;'> 5.51KB </span>","children":null,"spread":false}],"spread":true},{"title":"execl_test.suo <span style='color:#111;'> 26.00KB </span>","children":null,"spread":false}],"spread":true}],"spread":true}]

评论信息

  • wzctalent :
    学习了 还挺好
    2019-10-29
  • BF_BestFriend :
    挺好用的。。
    2019-08-12
  • z758970173 :
    学习了……
    2018-05-08
  • zhuzhengbin123 :
    逻辑思路清晰
    2018-01-22

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明