I never write c# code, but In c++ or java, I ever had access Excel, send the c++ codes, hope some help to you! ---------------------------------------------------------- package snsoftx.win; import snsoft.util.*; import com.jacob.com.*; import com.jacob.activeX.*; import java.util.*; import java.io.File; /** * Company: 南北公司 * @author: Grant * @email: wang_yi_ming@263.net * @version 5.0 * * MSExcelApp类用来操作Ms Excel文件: * 新建,删除文件, Sheet, Row, Col * comments: * 要使用MSExcelApp类, 必须jacob.dll的支持 * * expamples: * 1. 只读打开文件,读数据: * MSExcelApp excelApp = null; * try { excelApp = new MSExcelApp(); if( excelApp.openExcel("c:\\temp\\cc.xls","Sheet1") ) { int rowCount = excelApp.getRowCount(); int colCount = excelApp.getColumnCount(); System.out.println("rowCount=" + rowCount+",colCount=" + colCount); // get column info for (int col = 0; col < colCount; col++) System.out.println("colName:" + excelApp.getColumnName(col) + "\r\n"); excelApp.prepareFetchData(); // 为了提高查询速度 for (int r = 0; r < rowCount; r++) { excelApp.gotoRow( r ); for (int c = 0; c < colCount; c++) { Object ob = excelApp.getValue(c); // or ob = excelApp.getCellValue(r,c); s += (ob == null) ? "" : ob.toString() + ","; } System.out.println(s + "\r\n"); } excelApp.endFetchData(); excelApp.close(); } } catch (Exception ex) { ex.printStackTrace(); } * 2. 打开文件,修改文件 : * MSExcelApp excelApp = null; * try { excelApp = new MSExcelApp(); if( excelApp.openExcel("c:\\temp\\cc.xls","学生成绩单",false,false,true) ) { excelApp.addField("学号",0) excelApp.addField("姓