C#导出Excel的代码

时间:2013-02-02 11:07:24
【文件属性】:

文件名称:C#导出Excel的代码

文件大小:642B

文件格式:TXT

更新时间:2013-02-02 11:07:24

C# Excel

string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + file + ";" + "Extended Properties='Excel 8.0;HDR=Yes;IMEX=1'"; OleDbDataAdapter ExcelDA = new OleDbDataAdapter("SELECT * FROM [Sheet1$]", strConn); DataSet ExcelDs = new DataSet(); try { ExcelDA.Fill(ExcelDs, "ExcelInfo"); DataTable dt = ExcelDs.Tables[0]; return dt; } catch (Exception err) { Response.Write(err.ToString()); } return null;


网友评论