0
File file = new File("D:\\testExcelInput.xlsx");
FileInputStream fIP = new FileInputStream(file);
//get the existing sheet from the workbook
XSSFWorkbook wb = new XSSFWorkbook(fIP);
XSSFSheet sheet = wb.getSheetAt(0);
//get the count of already existing rows
int i=sheet.getPhysicalNumberOfRows();
Row row=sheet.createRow(++i);
//input date in the required format
Cell cellDate = row.createCell(0);
cellDate.setCellValue(dateFormat.format(date));
//input item ID
Cell cellItem = row.createCell(1);
//cellItem.setCellType(CellType.NUMERIC);
cellItem.setCellType(XSSFCell.CELL_TYPE_NUMERIC);
cellItem.setCellValue(ItemID);
//input name
Cell cellName = row.createCell(2);
cellName.setCellValue(ItemName);
//create a number cell and insert quantity
Cell cellQuant = row.createCell(3);
cellQuant.setCellType(XSSFCell.CELL_TYPE_NUMERIC);
cellQuant.setCellValue(quant);
try (//save the changes by writing the data in the workbook
FileOutputStream fileOut = new FileOutputStream("D:\\testExcelInput.xlsx")) {
wb.write(fileOut);
//wb.close();
これは私のコードです。私はエラーの背後に理由を見つけることができません。 hssfと.xlsファイルを使用したときはうまくいきましたが、xlsfファイルを使用する必要があったので、xssfを使用しました。エラーを解決する方法java.lang.NoClassDefFoundError:org/apache/xmlbeans/XmlObject