0
我有2個工作簿,我想在同一個寫寫在同一個文件中的多張excel文件,下面是我的代碼如何使用Apache POI
public void csvWriteToFile(HSSFWorkbook workbook1,HSSFWorkbook workbook2,String fileName){
try {
FileOutputStream out = new FileOutputStream(new File(fileName));
workbook1.write(out);
workbook2.write(out);
out.close();
System.out.println("Excel written successfully..");
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
這是創建Excel文件只有一頁。我在這裏做錯了什麼?