[英]Real-Time Excel Updates
I have a third party application that updates cell values by opening the excel file, setting values in cells, and writing (saving) the excel file. 我有一个第三方应用程序,通过打开Excel文件,设置单元格中的值,以及写入(保存)Excel文件来更新单元格值。 Suppose I have the excel spreadsheet open at all times, how I do have the spreadsheet reflect these changes in real-time?
假设我一直打开excel电子表格,我如何让电子表格实时反映这些变化?
Every time there is an update, I have to re-open the excel file to see the new changes. 每次有更新时,我都必须重新打开excel文件才能看到新的更改。
PS. PS。 I am using the Apache POI.
我正在使用Apache POI。
Thank you. 谢谢。
You cannot do this using Apache POI. 您无法使用Apache POI执行此操作。 If you have an Excel spreadsheet open in Excel, then you will get a
FileNotFoundException
if you attempt to write your changes to that file. 如果您在Excel中打开了Excel电子表格,那么如果您尝试将更改写入该文件,则会收到
FileNotFoundException
。 At least on Windows, you will get something like this: 至少在Windows上,你会得到这样的东西:
java.io.FileNotFoundException: MySpreadsheet.xlsx (The process cannot access the
file because it is being used by another process)
Additionally, even if this worked, there is nothing in the Apache POI API that interacts with the Excel application itself, so you cannot tell Excel to re-open the spreadsheet. 此外,即使这样可行,Apache POI API中也没有任何内容与Excel应用程序本身交互,因此您无法告诉Excel重新打开电子表格。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.