如何读取Excel文档
程序中遇到要读取Excel文档的数据,可不知怎么读?谢谢!
Microsoft.Office.Interop.Excel.ApplicationClass excelApp = new ApplicationClass(); excelApp.Application.Workbooks.Add(true); excelApp.Visible = true; // 使Excel可视 excelApp.ScreenUpdating = false; Workbook wb = excelApp.Workbooks.Open("文件路径", 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); Worksheet ws = (Worksheet)wb.ActiveSheet;//.Sheets[1];