示例#1
0
文件: XSSFRow.cs 项目: yesonsik/npoi
        /**
         * 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;
        }
示例#2
0
        public void RemoveCell(ICell cell)
        {
            if (cell.Row != this)
            {
                throw new ArgumentException("Specified cell does not belong to this row");
            }
            XSSFCell cell1 = (XSSFCell)cell;

            if (cell1.IsPartOfArrayFormulaGroup)
            {
                cell1.NotifyArrayFormulaChanging();
            }
            if (cell.CellType == CellType.FORMULA)
            {
                ((XSSFWorkbook)this._sheet.Workbook).OnDeleteFormula(cell1);
            }
            this._cells.Remove(cell.ColumnIndex);
        }