C#读取Excel文件方法一:直接读取(这种直接读取单元格的方法释放很重要)
- Excel.Applicationexcel=null;
- Excel.Workbookswbs=null;
- Excel.Workbookwb=null;
- Excel.Worksheetws=null;
- Excel.Rangerange1=null;
- objectNothing=System.Reflection.Missing.Value;
- try
- {
- excel=newExcel.Application();
- excel.UserControl=true;
- excel.DisplayAlerts=false;
- excel.Application.Workbooks.Open(this.
- FilePath,Nothing,Nothing,Nothing,Nothing,
- Nothing,Nothing,Nothing,Nothing,Nothing,