public void moveCell(HSSFCell cell, short newColumn) {if(cells.length > newColumn && cells[newColumn] != null) {throw new IllegalArgumentException("Asked to move cell to column " + newColumn + " but there's already a cell there");}if(! cells[cell.getColumnIndex()].equals(cell)) {throw new IllegalArgumentException("Asked to move a cell, but it didn't belong to our row");}removeCell(cell, false);cell.updateCellNum(newColumn);addCell(cell);}
public void MoveCell(ICell cell, int newColumn){if(cells.ContainsKey(newColumn)){throw new ArgumentException("Asked to move cell to column " + newColumn + " but there's already a cell there");}bool existflag = false;foreach (ICell cellinrow in cells.Values){if (cellinrow.Equals(cell)){existflag = true;break;}}if (!existflag){throw new ArgumentException("Asked to move a cell, but it didn't belong to our row");}RemoveCell(cell, false);((HSSFCell)cell).UpdateCellNum(newColumn);AddCell(cell);}