尝试在 Eclipse 中使用 selenium JUni4 Web 驱动程序打开 excel 文件时出现以下错误。错误和代码如下所示。我是 JAVA 的新手。请帮忙。
public void xlRead_TC(String sPath, int sSheet) throws Exception{
//Workbook book = Workbook.createWorkbook(f);
System.out.println("Step 1B - Opening excel files Reached");
File myxl = new File(sPath);
FileInputStream myStream = new FileInputStream(myxl);
//Workbook w;
//w = Workbook.getWorkbook(myStream);
XSSFWorkbook myWB = new XSSFWorkbook(myStream);
//XSSFSheet mySheet = myWB.getSheetAt(sSheet); // Referring to 1st sheet
//xRows_Inp = mySheet.getLastRowNum()+1;
//xCols_Inp = mySheet.getRow(0).getLastCellNum();
System.out.println("Rows are " + xRows_Inp);
System.out.println("Cols are " + xCols_Inp);
//Workbook[] wbs = new Workbook[] { new HSSFWorkbook(), new XSSFWorkbook() };
//xRows_TC = mySheet.getLastRowNum()+1;
//xCols_TC = mySheet.getRow(0).getLastCellNum();
//System.out.println("Rows are " + xRows_TC);
//System.out.println("Cols are " + xCols_TC);
//xData_TC = new String[xRows_TC][xCols_TC];
}
例外
java.lang.NoClassDefFoundError: org/dom4j/DocumentException
at org.apache.poi.openxml4j.opc.OPCPackage.init(OPCPackage.java:154)
at org.apache.poi.openxml4j.opc.OPCPackage.<init>(OPCPackage.java:141)
at org.apache.poi.openxml4j.opc.Package.<init>(Package.java:54)