編集したファイルをベースファイルにコピーせずにワークブックを保存して保存することはできますか?ここで 異なる名前で保存せずにワークブックを編集/書き込みする
は私のコードです:File file = new File("base.xlsx");
Workbook workbook = WorkbookFactory.create(file);
Sheet sheet = workbook.getSheet("data");
...
//creating rows and cells, writing stuff
...
//saving
FileOutputStream fos = new FileOutputStream("edited.xlsx");
workbook.write(fos);
workbook.close();
fos.close();
//now both the base.xlsx and edited.xlsx contain all the new and previous data - and are exactly the same size
//using only
workbook.close();
//the workbook file size changes (approximately to the same as edited.xlsx) and the timestamp is current
//BUT the data doesn't get saved
のみ、他の可能性私はのInputStreamを使用している知っている(しかし、その後、私はメモリ(10メガバイトのの.xlsxファイルと2ギガバイトのヒープ領域)から抜け出す)
混乱する部分は、なぜ別のファイルに書き出すとbase.xlsxファイルが編集されるのですか?
ありがとうございました! – Beig