我在嘗試讀取Excel 2007電子表格(.xlsx)時遇到問題。我試圖通過使用POI library用Java實現的方法,但是我得到這個錯誤:從JAVA中的Excel表單2007中讀取數據
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xmlbeans/XmlException
,這是我的方法:
public void No_rows() throws IOException {
File inputWorkbook = new File(inputFile);
FileInputStream w = new FileInputStream(inputWorkbook);
XSSFWorkbook workbook = new XSSFWorkbook(w);
XSSFSheet sheet = workbook.getSheetAt(0);
Iterator rows = sheet.rowIterator();
int number=sheet.getLastRowNum();
this.num_rows = number;
w.close();
}