0
for (int i = 0; i < newSheet.getLastRowNum(); i++) {
            if (.....) {
                newSheet.removeRow(newSheet.getRow(i));
                newSheet.shiftRows(i+1, newSheet.getLastRowNum(), -1);
                i--;
            }   
        }

It's not giving any compilation error or runtime error but the excel file I'm working on is getting corrupt.

It's showing this messgae while opening file-

Error when opening in Excel:

Removed Records: Cell information from /xl/worksheets/sheet1.xml part

So any bug fixes on this available or what I'm supposed to do?

Dino
  • 7,779
  • 12
  • 46
  • 85

1 Answers1

0

Unfortunately, as of Apache POI release version 4.1.0, there is a bug in the XSSFSheet shiftRows(); that has not been fixed yet. There is currently a bug entered for tracking and remediation Here.

Until it is fixed, I recommend downgrading your POI JAR version to 3.17 (see this StackOverflow Post) or use a version of the fix shown in the same post by "Axel Richter".

Hopefully, Apache will soon have the bug fixed in a newer release.

SirTech
  • 11
  • 4