Victor Pavlov Member Licensed User Longtime User Mar 12, 2014 #1 We created Excel file through jexcel library the file stays in ReadOnly mode. The message from Excel is: The file is locked for editing by "". Please, advice.
We created Excel file through jexcel library the file stays in ReadOnly mode. The message from Excel is: The file is locked for editing by "". Please, advice.
Erel B4X founder Staff member Licensed User Longtime User Mar 13, 2014 #2 Not sure why it is locked. However you can write the table to a temporary file and then copy it: Code: Copy File.Copy(File.DirApp, "1.xls", File.DirApp, "2.xls") You can then use the same temporary file again. Upvote 0
Not sure why it is locked. However you can write the table to a temporary file and then copy it: Code: Copy File.Copy(File.DirApp, "1.xls", File.DirApp, "2.xls") You can then use the same temporary file again.
alienhunter Active Member Licensed User Longtime User Mar 14, 2014 #3 hmmm i noticed that too everything that fx writes is locked , but like erel wrote I copy it in a different place to be able to open a file with another application when fx is running Upvote 0
hmmm i noticed that too everything that fx writes is locked , but like erel wrote I copy it in a different place to be able to open a file with another application when fx is running
C Crock Member Licensed User Longtime User Apr 6, 2014 #4 Even though the workbook is closed, NumberOfSheets returns 1 and I get no error. ... Code: Copy 'add some cells etc wb.Write wb.Close Log("sheetcount=" & wb.NumberOfSheets) But if I try another wb.close it raises an error, as expected. Unlike alienhunter's experience, I find that if the jar is still running, I still cannot open the xls from another Windows folder. I wonder if wb.close is not properly closing the file and releasing the lock. Can someone confirm the above? Last edited: Apr 6, 2014 Upvote 0
Even though the workbook is closed, NumberOfSheets returns 1 and I get no error. ... Code: Copy 'add some cells etc wb.Write wb.Close Log("sheetcount=" & wb.NumberOfSheets) But if I try another wb.close it raises an error, as expected. Unlike alienhunter's experience, I find that if the jar is still running, I still cannot open the xls from another Windows folder. I wonder if wb.close is not properly closing the file and releasing the lock. Can someone confirm the above?
Erel B4X founder Staff member Licensed User Longtime User Apr 6, 2014 #5 wb.Close calls the native close method. Have you tried the code I posted in post #2? Upvote 0
C Crock Member Licensed User Longtime User Apr 7, 2014 #6 Erel said: wb.Close calls the native close method. Have you tried the code I posted in post #2? Click to expand... Thanks, I can see that is a workaround but it makes no sense that the native close method keeps a file locked. Is this a Java "feature"? Upvote 0
Erel said: wb.Close calls the native close method. Have you tried the code I posted in post #2? Click to expand... Thanks, I can see that is a workaround but it makes no sense that the native close method keeps a file locked. Is this a Java "feature"?
Erel B4X founder Staff member Licensed User Longtime User Apr 7, 2014 #7 It is not related to Java. It seems like an issue with the native JXL library. Upvote 0
C Crock Member Licensed User Longtime User Apr 7, 2014 #8 Erel said: It is not related to Java. It seems like an issue with the native JXL library. Click to expand... Thanks Erel. I just had a good search and found nothing about this read-only issue. If I find anything else I'll post back here. Upvote 0
Erel said: It is not related to Java. It seems like an issue with the native JXL library. Click to expand... Thanks Erel. I just had a good search and found nothing about this read-only issue. If I find anything else I'll post back here.