第一种方法较慢,但是数据格式都比较好,需要引用excel的 Microsoft.Office.Interop.Excel.dll office.dll #Region "导出excel函数" Public Sub DcExcel(ByVal DGV As DataGridView) '把datagridview中的数据导出到excel Dim wapp As New Microsoft.Office.Interop.Excel.Application …
using System; using System.IO; using System.Data; using System.Collections; using System.Data.OleDb; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; /// <summary> /// Excel操作类 /// </summary> /// Microsoft Excel 11.0 Obj…
using System; using System.Collections.Generic; using System.Text; using System.Data; using System.Windows.Forms; using System.Reflection; namespace DMS { /// <summary> /// C#操作Excel类 /// </summary> class ExcelOperate { //法一 //public bool Data…
1.通用导出Excel功能. 2.将 MSHFlexGrid数据导出到Excel文件通用功能. 3.具体代码如下: '将下列代码保存到一模块文件中,调用方法:Export fgrid1,cd1 Public Sub Export(flexgridname As MSHFlexGrid, CD1 As CommonDialog) Dim xlApp As Object 'Excel.Application Dim xlBook As Object 'Excel.Workbook Dim xlShe…