【发布时间】:2017-09-06 07:38:51
【问题描述】:
// Declaring the path of the Excel file with the name of the Excel file
String sPath = "E:\\Practice_space\\MyKDTTest\\src\\dataengine\\DataEngine.xlsx";
// Here we are passing the Excel path and SheetName as arguments to connect with Excel file
ExcelUtils.setExcelFile(sPath, "TestSteps");
上面的代码我在java的主类中提到过。我正在调用已在其他类中定义的方法 setExcelFile,如下所示
public static void setExcelFile(String Path,String SheetName) throws Exception {
FileInputStream ExcelFile = new FileInputStream(Path);
ExcelWBook = new XSSFWorkbook(ExcelFile);
ExcelWSheet = ExcelWBook.getSheet(SheetName);
}
但是我遇到了一个错误,请帮助我,在此先感谢
【问题讨论】:
-
你确定
setExcelFile方法在类ExcelUtils中吗? -
这个错误是这样的吗?:stackoverflow.com/questions/26034994/…
-
您可以清除并重建您的项目以摆脱这些问题。