/** * Adds a cell to this row, growing the array of cells as required * * @param cv the cell to add */ public void addCell(CellValue cv) { int col = cv.getColumn(); if (col >= maxColumns) { //logger.warn("Could not add cell at " + // CellReferenceHelper.getCellReference(cv.getRow(), // cv.getColumn()) + // " because it exceeds the maximum column limit"); return; } // Grow the array if needs be if (col >= cells.Length) { CellValue[] oldCells = cells; cells = new CellValue[System.Math.Max(oldCells.Length + growSize, col + 1)]; System.Array.Copy(oldCells, 0, cells, 0, oldCells.Length); oldCells = null; } // Remove any cell features from the cell being replaced if (cells[col] != null) { WritableCellFeatures wcf = cells[col].getWritableCellFeatures(); if (wcf != null) { wcf.removeComment(); // if the cell is part of a shared data validation,then don't remove // the validation if (wcf.getDVParser() != null && !wcf.getDVParser().extendedCellsValidation()) { wcf.removeDataValidation(); } } } cells[col] = cv; numColumns = System.Math.Max(col + 1, numColumns); }