I know there is a bug , so I read many work around methods and it appears that the most popular is to start a new
instance of FileInputStream
So I tried
for (int i = 0 ; i < 2 ; i ++) {
FileInputStream out = new FileInputStream ( new File ( " C:\\ .xlsx ") ) ; // new
....
out close(); //make sure to get rid of it
}
However, this still throws this exception
There is a patch for on this page
if (prev != null) {
/*CTRow ctRow = prev.getCTRow();
/ ctRow.set(CTRow.Factory.newInstance()); */ <--- to be removed
Iterator it = prev.iterator();
while(it.hasNext()) {
it.next();
it.remove();
}
}
But i am not sure how to use it