Note that there are some explanatory texts on larger screens.

plurals
  1. POPOI - Excel remains held by some process and cannot be edited
    primarykey
    data
    text
    <p>I am using POI to read,edit and write excel files. My process flow is like write an excel, read it and again write it.</p> <p>Then if I try to edit the file using normal desktop excel application while my Java app is still running, the excel cannot be saved, it says some process is holding the excel, I am properly closing all file handles.</p> <p>Please help and tell me how to fix this issue.</p> <pre><code>SXSSFWorkbook wb = new SXSSFWorkbook(WINDOW_SIZE); Sheet sheet = getCurrentSheet();//stores the current sheet in a instance variable for (int rowNum = 0; rowNum &lt; data.size(); rowNum++) { if (rowNum &gt; RECORDS_PER_SHEET) { if (rowNum % (RECORDS_PER_SHEET * numberOfSheets) == 1) { numberOfSheets++; setCurrentSheet(wb.getXSSFWorkbook().createSheet()); sheet = getCurrentSheet(); } } final Row row = sheet.createRow(effectiveRowCnt); for (int columnCount = 0; columnCount &lt; data.get(rowNum).size(); columnCount++) { final Object value = data.get(rowNum).get(columnCount); final Cell cell = row.createCell(columnCount); //This method creates the row and cell at the given loc and adds value createContent(value, cell, effectiveRowCnt, columnCount, false, false); } } public void closeFile(boolean toOpen) { FileOutputStream out = null; try { out = new FileOutputStream(getFileName()); wb.write(out); } finally { try { if (out != null) { out.close(); out = null; if(toOpen){ // Open the file for user with default program final Desktop dt = Desktop.getDesktop(); dt.open(new File(getFileName())); } } } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload