如何数据表导出到Excel在C# [英] How to export DataTable to Excel in C#
本文介绍了如何数据表导出到Excel在C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何数据表中导出到Excel在C#中。我使用Windows窗体。该数据表与DataGridView控件有关。我得的数据表记录导出到Excel
How to export DataTable to Excel in C#. I am using Windows form. The DataTable is associated with DataGridView control. I have to export records of DataTable to Excel
推荐答案
我会建议 ClosedXML -
您可以将一个数据表到Excel工作表的一些的非常的可读code:
You can turn a DataTable into an Excel worksheet with some very readable code:
XLWorkbook wb = new XLWorkbook();
DataTable dt = GetDataTableOrWhatever();
wb.Worksheets.Add(dt,"WorksheetName");
开发商响应和有益的。该项目正在积极开发和文档是一流的。
The developer is responsive and helpful. The project is actively developed, and the documentation is superb.
这篇关于如何数据表导出到Excel在C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文