Here is a problem I have reported to Lars but have not received an answer or an acknowledgement of him receiving it. Maybe someone here can help. Maybe he's on vacation - hope all is well.
I have two apps built with XLSReadWriteII v4. Each works fine on its own.
However,
I run app1 and read and write to an XLSX file. Then, without closing app1, I open app2, I cannot read ANY XLSX file from app2 while app1 is open (even if app1 is no longer processing a file). It appears that XLS creates a specific settings file when reading XLSX files, and locks that file until the app is closed, preventing any other app from creating the necessary settings file.
This is a problem for me because I use one app to, optionally, call another to do some further processing on a file and then return, but now cannot open the file (or any XLSX file) from the second app.
Any help?
Thanks.
Can't run 2 apps built using XLS at the same time
On further examination, this issue is caused by a temp file that XLS creates when it begins reading an .xlsx file. The temp file is called XLS3E8.tmp. It is apparently held by the XLS unit until the app terminates (even if the reading and writing of the file is completed). The file remains after the app is terminated but is no longer held, so that it can be deleted when XLS initializes the next time the app runs.
I've tried renaming the file within my app before it calls app2, but can't do that because XLS won't let go. Does anyone know a way to give control of the file back to my app so that I can rename it (so that my other app can create one of its own)? Or any other ideas?
Thanks.
S
I've tried renaming the file within my app before it calls app2, but can't do that because XLS won't let go. Does anyone know a way to give control of the file back to my app so that I can rename it (so that my other app can create one of its own)? Or any other ideas?
Thanks.
S
Can't run 2 apps built using XLS at the same time
I did hear back from Lars - he assured me that he will fix this in an upcoming update.
However, in the meantime, there is a workaround. XLS can be set to create the temp file in memory, so there is no naming conflict. If you are using XLS to read Excel 2007 files, you should add
XLS.TempFileMode := tfmInMemory
to your code to prevent this problem from occurring.
Scott Hochberg
Postage $aver Software
savepostage.com
However, in the meantime, there is a workaround. XLS can be set to create the temp file in memory, so there is no naming conflict. If you are using XLS to read Excel 2007 files, you should add
XLS.TempFileMode := tfmInMemory
to your code to prevent this problem from occurring.
Scott Hochberg
Postage $aver Software
savepostage.com
Re: Can't run 2 apps built using XLS at the same time
just wondering: has this been solved finally? Is there an update? It's 2 years later..
Gerard
Gerard
-
- Posts: 13
- Joined: Tue Feb 13, 2007 8:47 am
- Location: West Sussex England
Re: Can't run 2 apps built using XLS at the same time
Looks like it *has* been fixed. The code to get he filename is now ...
function XLSGetTempFile: WideString;
begin
Result := TempFilePrefix + IntToStr(GetTickCount) + '.tmp';
end;
So that should give a different name each time it's called.
function XLSGetTempFile: WideString;
begin
Result := TempFilePrefix + IntToStr(GetTickCount) + '.tmp';
end;
So that should give a different name each time it's called.
Joe Griffin
GerbilSoft Associates Limited
GerbilSoft Associates Limited
Re: Can't run 2 apps built using XLS at the same time
Hello
It's true that this is fixed, but the solution was not to use GetTickCount (that caused the problem), as it only changes value every millisecond. Now a GUID is used in the temp file name instead.
It's true that this is fixed, but the solution was not to use GetTickCount (that caused the problem), as it only changes value every millisecond. Now a GUID is used in the temp file name instead.
Lars Arvidsson, Axolot Data