英文:
Java Apache poi cannot delete folder containing Excel files and cannot delete sheets in Excel files
问题
我正在尝试使用Java中的Apache POI编写一个程序,应该可以编辑一些Excel文件。
我遇到了以下问题:包含我的Excel文件的文件夹似乎在运行程序后被锁定了。如果我尝试删除它,它会显示我需要从管理员那里获得权限。在相同位置的任何其他文件夹以及该文件夹内部的文件夹都没有出现此消息。由于这是我的私人笔记本电脑,我是这台计算机的管理员。
我遇到的第二个问题是,在运行程序后,我无法删除它所创建的工作表。我必须手动保存Excel文件,关闭它,重新打开它,然后才能再次删除工作表。
提前感谢您的帮助。
英文:
I am trying to write a program with apache poi in Java that should edit some Excel files.
I am running into the following problem: the folder which contains my Excel file seems to have been locked after having run the program. If I try to delete it, it says I need to get permission from the administrator. I do not get this message with any other folders in the same location, nor with folders inside this folder. I am the administrator on this computer, as it is my private laptop.
The second problem I have is that after I run the program, I am thereafter unable to delete sheets that it created. I have to manually save the Excel file, close it, reopen it, and then I can delete sheets again.
Thanks in advance.
专注分享java语言的经验与见解,让所有开发者获益!
评论