将excel文件导出到DataGridView [英] export a excel file to DataGridView
本文介绍了将excel文件导出到DataGridView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在datagridview中显示excel文件或如何在Excel中将excel文件导出到DataGridView
解决方案
这三个链接中的每一个都讨论了解决问题的方法 -
http ://www.c-sharpcorner.com/uploadfile/ankurmee/import-data-from-excel-to-datagridview-in-C-Sharp/ [ ^ ]
http://vinodvillain1986.blogspot.in/2012/ 11 / import-data-from-excel-to-datagridview.html [ ^ ]
http://www.dotneter.com/import-excel-file-into-datagridview [ ^ ]
您好,您可以使用此.net excel 组件,轻松导入和导出 DataGridView到Excel 。
这是一个 C#excel 示例代码:
// 将活动工作表导出到DataGridView。
DataGridViewConverter.ExportToDataGridView(
excelFile.Worksheets.ActiveWorksheet,
dataGridView,
new ExportToDataGridViewOptions());
// 将DataGridView导入活动工作表。
DataGridViewConverter .ImportFromDataGridView(
excelFile.Worksheets.ActiveWorksheet,
dataGridView,
new ImportFromDataGridViewOptions());
how can display a excel file in datagridview OR how can export a excel file to DataGridView in C#
解决方案
Each of these three links discusses solutions to your problem -
http://www.c-sharpcorner.com/uploadfile/ankurmee/import-data-from-excel-to-datagridview-in-C-Sharp/[^]
http://vinodvillain1986.blogspot.in/2012/11/import-data-from-excel-to-datagridview.html[^]
http://www.dotneter.com/import-excel-file-into-datagridview[^]
Hi, you can use this .net excel component and easily import and export DataGridView to Excel.
Here is a C# excel sample code:
// Export active worksheet to DataGridView. DataGridViewConverter.ExportToDataGridView( excelFile.Worksheets.ActiveWorksheet, dataGridView, new ExportToDataGridViewOptions()); // Import DataGridView back to active worksheet. DataGridViewConverter.ImportFromDataGridView( excelFile.Worksheets.ActiveWorksheet, dataGridView, new ImportFromDataGridViewOptions());
这篇关于将excel文件导出到DataGridView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文