我无法将数据附加到现有的 Excel 工作表中。
这是我的代码:
fis = new FileInputStream(file);
fs = new POIFSFileSystem(fis);
HSSFWorkbook wb1 = new HSSFWorkbook(fs);
sheet1 = wb1.getSheet("sheet1");
System.out.println("Last Row No.: " + sheet1.getLastRowNum());
row = sheet1.createRow(sheet1.getLastRowNum()+ 1);
System.out.println("Last Row No.: " + sheet1.getLastRowNum());
row.createCell(0).setCellValue(2);
row.createCell(1).setCellValue(2.2);
row.createCell(2).setCellValue(true);
fos = new FileOutputStream(file,true);
wb1.write(fos);
fos.flush();
fos.close();