1 添加引用
项目-》添加引用-》com-》Microsoft Excel 14.0 Object Library
2 Form1.cs 中
using System.Reflection; // 引用这个才能使用Missing字段
using Excel = Microsoft.Office.Interop.Excel;
3代码中
1)打开文件找到工作表
Excel.Application ThisApplication = new Excel.Application();
Excel.Workbook ThisWorkbook = ThisApplication.Workbooks._Open(@"E:\\0128\\"+textBox1.Text+@".xlsx", Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
ThisApplication.Visible = true;
Excel.Worksheet xlsWorkSheet = (Excel.Worksheet)ThisWorkbook.Worksheets.get_Item(1);
2)读取所有行</