The code is as follows: protected void removeAllCells() { for (HSSFCell cell : cells) { if (cell != null) { removeCell(cell, true); } } cells=new HSSFCell[INITIAL_CAPACITY]; } NPOI fixed a bug: https://github.com/nissl-lab/npoi/commit/7a885c42e2f21147c1c4b744db55f6d4af1e69fc The buggy code is as follows: public void RemoveAllCells(){ int initialLen = cells.Count; for (int i = 0; i < initialLen; i++){ RemoveCell(cells[i], true); }} The fixed code is as follows: public void RemoveAllCells(){ foreach (ICell cell in cells.Values){ RemoveCell(cell, true); }}
We are not going to just copy NPOI. Please provide real world examples. POI is a volunteer project and it is normally best to provide a patch with a test case yourself.
This is not an issue Apache POI as the cell-array is not changed when removing. Also it seems a similar change was already applied in 2016.