读文件:
C# code
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;

写文件:
以"\t" 和"\r\n"分隔文本输出,其中"\t"是列分隔符,"\r\n"是行分隔符,然后文件格式定义为XLS就可以,但如果想输出带格式设置的XLS文件,则需要使用EXCEL控件

相关文章:

  • 2022-02-21
  • 2022-12-23
  • 2021-09-14
  • 2021-11-29
  • 2021-05-31
  • 2021-12-05
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-03
  • 2021-10-06
  • 2021-11-23
  • 2021-11-29
  • 2021-07-02
  • 2022-12-23
相关资源
相似解决方案