:我们一般用的方法是将表遍历一遍,然后写入到excel中,主要代码如下: /// /// 指定文件名称、表名、DataGridView导出DataGridView中的数据到Excel中 /// /// 输出文件的位置 /// 表名 /// DataGridView名称