public void removeRow(Row row) {HSSFRow hrow = (HSSFRow) row;if (row.getSheet() != this) {throw new IllegalArgumentException("Specified row does not belong to this sheet");}for (Cell cell : row) {HSSFCell xcell = (HSSFCell) cell;if (xcell.isPartOfArrayFormulaGroup()) {String msg = "Row[rownum=" + row.getRowNum() + "] contains cell(s) included in a multi-cell array formula. You cannot change part of an array.";xcell.tryToDeleteArrayFormula(msg);}}if (_rows.size() > 0) {Integer key = Integer.valueOf(row.getRowNum());HSSFRow removedRow = _rows.remove(key);if (removedRow != row) {throw new IllegalArgumentException("Specified row does not belong to this sheet");}if (hrow.getRowNum() == getLastRowNum()) {_lastrow = findLastRow(_lastrow);}if (hrow.getRowNum() == getFirstRowNum()) {_firstrow = findFirstRow(_firstrow);}_sheet.removeRow(hrow.getRowRecord());if(_rows.size() == 0) {_firstrow = -1;_lastrow = -1;}}}
public void RemoveRow(IRow row){if (row.Sheet != this){throw new ArgumentException("Specified row does not belong to this sheet");}foreach (ICell cell in row){HSSFCell xcell = (HSSFCell)cell;if (xcell.IsPartOfArrayFormulaGroup){String msg = "Row[rownum=" + row.RowNum + "] contains cell(s) included in a multi-cell array formula. You cannot change part of an array.";xcell.NotifyArrayFormulaChanging(msg);}}if (rows.Count > 0){int key = row.RowNum;HSSFRow removedRow = (HSSFRow)rows[key];rows.Remove(key);if (removedRow != row){if (removedRow != null){rows[key] = removedRow;}throw new InvalidOperationException("Specified row does not belong to this _sheet");}if (row.RowNum == LastRowNum){lastrow = FindLastRow(lastrow);}if (row.RowNum == FirstRowNum){firstrow = FindFirstRow(firstrow);}CellValueRecordInterface[] cellvaluerecods = _sheet.GetValueRecords();for (int i = 0; i < cellvaluerecods.Length; i++){if (cellvaluerecods[i].Row == key){_sheet.RemoveValueRecord(key, cellvaluerecods[i]);}}_sheet.RemoveRow(((HSSFRow)row).RowRecord);}}