diff --git a/src/java/org/apache/poi/hssf/model/Sheet.java b/src/java/org/apache/poi/hssf/model/Sheet.java index 5017583f9..eb924b3e7 100644 --- a/src/java/org/apache/poi/hssf/model/Sheet.java +++ b/src/java/org/apache/poi/hssf/model/Sheet.java @@ -995,6 +995,10 @@ public class Sheet implements Model d.setFirstRow(row.getRowNumber()); } //IndexRecord index = null; + //If the row exists remove it, so that any cells attached to the row are removed + RowRecord existingRow = rows.getRow(row.getRowNumber()); + if (existingRow != null) + rows.removeRow(existingRow); rows.insertRow(row);