Sorry.  I missed a line in the code.  The last 2 lines are:

FileOutputStream out = new FileOutputStream(masterPath);
wb.write(out); //Fails because the file is locked.


I am trying to read an excel 2007 document, modify it, and write it back
out to the same file. When I instantiate XSSFWorkbook, the operating
system (windows XP) will not allow me to change the file until the java
program closes.  I've tried everything I can think of to get the file to
release.  The lock even exists long after my XSSFWorkbook object is out
of scope.

 

What I am trying to do is simple.

 

String masterpath = "some valid path on my C drive";

XSSFWorkbook wb = new XSSFWorkbook(masterPath);

--change a few cell values

wb.write(out);  //Fails because the file is locked.

 

 

Any ideas?

 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to