2014-01-20 73 views

回答

0
You can do something like this-- 

Excel.Application xlApp = new Excel.Application(); 
Excel.Workbook xlWorkbook = xlApp.Workbooks.Open(@"C:\test.xlsx"); 
Excel.Worksheet xlWorksheet = (Excel.Worksheet) xlWorkbook.Sheets[1]; 
Excel.Range xlRange = xlWorksheet.UsedRange; 
int rowCount = xlRange.Rows.Count; 
int colCount = xlRange.Columns.Count; 
var cellvalue = (xlRange.Cells[2,colCount-1] as Excel.Range).Value2.ToString(); 
相關問題