/** * update cell references when Shifting rows * * @param n the number of rows to move */ internal void Shift(int n) { int rownum = RowNum + n; CalculationChain calcChain = ((XSSFWorkbook)_sheet.Workbook).GetCalculationChain(); int sheetId = (int)_sheet.sheet.sheetId; String msg = "Row[rownum=" + RowNum + "] contains cell(s) included in a multi-cell array formula. " + "You cannot change part of an array."; foreach (ICell c in this) { XSSFCell cell = (XSSFCell)c; if (cell.IsPartOfArrayFormulaGroup) { cell.NotifyArrayFormulaChanging(msg); } //remove the reference in the calculation chain if (calcChain != null) { calcChain.RemoveItem(sheetId, cell.GetReference()); } CT_Cell CT_Cell = cell.GetCTCell(); String r = new CellReference(rownum, cell.ColumnIndex).FormatAsString(); CT_Cell.r = r; } RowNum = rownum; }
/** * Remove the Cell from this row. * * @param cell the cell to remove */ public void RemoveCell(ICell cell) { if (cell.Row != this) { throw new ArgumentException("Specified cell does not belong to this row"); } XSSFCell xcell = (XSSFCell)cell; if (xcell.IsPartOfArrayFormulaGroup) { xcell.NotifyArrayFormulaChanging(); } if (cell.CellType == CellType.Formula) { ((XSSFWorkbook)_sheet.Workbook).OnDeleteFormula(xcell); } _cells.Remove(cell.ColumnIndex); }