覆盖excel(xls)文件时出错(无法对打开了用户映射部分的文件执行请求的操作)

时间:2017-08-21 14:34:57

标签: java apache-poi

Workbook workbook = new HSSFWorkbook();
//
//Other stuff here
FileOutputStream outputStream = new FileOutputStream(location);
workbook.write(outputStream);
outputStream.close();

第一次这段代码工作正常,但我需要在用户请求时覆盖同名文件 但是当我的程序再次进入此循环时,会出现以下错误:

The requested operation cannot be performed on a file with a user-mapped section open

当我尝试手动打开文件时,它会弹出一个显示文件被锁定的文件。

0 个答案:

没有答案