hi! When I remove row there is an exception (see below) example: import java.io.FileOutputStream; import java.io.IOException; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFRichTextString; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; public class Test { public static void main(String[] args) { try { HSSFWorkbook wb = new HSSFWorkbook(); HSSFSheet sheet = wb.createSheet(); for (int i = 0; i < 10; i++) { HSSFRow row = sheet.createRow(i); HSSFCell c1 = row.createCell((short) 0); c1.setCellValue(new HSSFRichTextString("TEST")); HSSFCell c2 = row.createCell((short) 1); c2.setCellValue(new HSSFRichTextString("TEST2")); } sheet.removeRow(sheet.getRow(5)); FileOutputStream out = new FileOutputStream("C:\\2.xls"); wb.write(out); } catch (IOException e) { e.printStackTrace(); } } } exception: java.lang.ArrayIndexOutOfBoundsException: 2144 at org.apache.poi.util.LittleEndian.putNumber(LittleEndian.java:511) at org.apache.poi.util.LittleEndian.putShort(LittleEndian.java:244) at org.apache.poi.hssf.record.EOFRecord.serialize(EOFRecord.java:80) at org.apache.poi.hssf.model.Sheet.serialize(Sheet.java:719) at org.apache.poi.hssf.usermodel.HSSFWorkbook.getBytes(HSSFWorkbook.java:937) at org.apache.poi.hssf.usermodel.HSSFWorkbook.write(HSSFWorkbook.java:875) at Test.main(Test.java:36)
I did verify that this bug exists in 3.0-alpha2 jar. However, this seems to be already fixed in SVN trunk.