读Excel行数出错
excelApp = new Microsoft.Office.Interop.Excel.Application();
excelWBs = excelApp.Workbooks;
excelWB = excelWBs.Add(Type.Missing);
excelWB = excelApp.Workbooks.Open(filePath, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
excelSheets = excelWB.Sheets;
excelWSheet = excelSheets.get_Item(1) as Excel._Worksheet;
excelWSheet.Activate();
range = excelWSheet.UsedRange;
int intRowCount = range.Rows.Count;
为什么明明我的Excel文件里面只用了5行,但是intRowCount返回的却是15行,哪位高手能帮忙看看到底哪里出了问题?有什么方法可以解决吗?