I want to modify an excel, I want to add a new row (using shiftrow()
method) but it doesn't work. I know why I am having this error but is there any other way how to do it? When meeting a certain requirement I want to shift a row and fill those cells.
.................
......................
Iterator<Row> rowIterator = sheet.rowIterator();
while(rowIterator.hasNext()) {
XSSFRow currentRow = (XSSFRow) rowIterator.next();
Iterator<Cell> cellIterator = currentRow.cellIterator();
while(cellIterator.hasNext()) {
XSSFCell currentCell = (XSSFCell) cellIterator.next();
if(currentCell.getStringCellValue().equalsIgnoreCase("xxxxxx")){
sheet.shiftRows(13, sheet.getLastRowNum(), 10);//java.util.ConcurrentModificationException
//fill these cells just created
}
}
}
Thank you.