// 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);
}
但是我收到错误,请帮助我,提前致谢
最佳答案
“简单”:编译器在编译上述代码时看到的ExcelUtils
类不包含该方法定义。
换句话说:您的设置中有问题。例如,当您更改类的java源代码时,可能会发生这种情况 - 但您忘记编译它。或者您忘记重新构建 JAR 存档。
长话短说:您的设置存在某种不一致。由于我们不了解该设置,因此这里只能说这么多!
关于java - ExcelUtils 类型的方法 setExcelFile(String, String) 未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46069422/