/** * Removes all the cells from the row, and their * records too. */ protected void removeAllCells() { for (HSSFCell cell : cells) { if (cell != null) { removeCell(cell, true); } } cells=new HSSFCell[INITIAL_CAPACITY]; }
/** * remove the HSSFCell from this row. * @param cell to remove */ @Override public void removeCell(Cell cell) { if(cell == null) { throw new IllegalArgumentException("cell must not be null"); } removeCell((HSSFCell)cell, true); } private void removeCell(HSSFCell cell, boolean alsoRemoveRecords) {
/** * Moves the supplied cell to a new column, which * must not already have a cell there! * @param cell The cell to move * @param newColumn The new column number (0 based) */ public void moveCell(HSSFCell cell, short newColumn) { // Ensure the destination is free if(cells.length > newColumn && cells[newColumn] != null) { throw new IllegalArgumentException("Asked to move cell to column " + newColumn + " but there's already a cell there"); } // Check it's one of ours if(! cells[cell.getColumnIndex()].equals(cell)) { throw new IllegalArgumentException("Asked to move a cell, but it didn't belong to our row"); } // Move the cell to the new position // (Don't remove the records though) removeCell(cell, false); cell.updateCellNum(newColumn); addCell(cell); }
HSSFCell cell = (HSSFCell) cells.next(); HSSFHyperlink link = cell.getHyperlink(); row.removeCell(cell); CellValueRecordInterface cellRecord = cell.getCellValueRecord(); cellRecord.setRow(rowNum + n);
/** * Removes all the cells from the row, and their * records too. */ protected void removeAllCells() { for (HSSFCell cell : cells) { if (cell != null) { removeCell(cell, true); } } cells=new HSSFCell[INITIAL_CAPACITY]; }
/** * Removes all the cells from the row, and their * records too. */ protected void removeAllCells() { for(int i=0; i<cells.length; i++) { if(cells[i] != null) { removeCell(cells[i], true); } } cells=new HSSFCell[INITIAL_CAPACITY]; }
/** * Removes all the cells from the row, and their * records too. */ protected void removeAllCells() { for(int i=0; i<cells.length; i++) { if(cells[i] != null) { removeCell(cells[i], true); } } cells=new HSSFCell[INITIAL_CAPACITY]; }
/** * remove the HSSFCell from this row. * @param cell to remove */ @Override public void removeCell(Cell cell) { if(cell == null) { throw new IllegalArgumentException("cell must not be null"); } removeCell((HSSFCell)cell, true); } private void removeCell(HSSFCell cell, boolean alsoRemoveRecords) {
/** * remove the HSSFCell from this row. * @param cell to remove */ public void removeCell(Cell cell) { if(cell == null) { throw new IllegalArgumentException("cell must not be null"); } removeCell((HSSFCell)cell, true); } private void removeCell(HSSFCell cell, boolean alsoRemoveRecords) {
/** * remove the HSSFCell from this row. * @param cell to remove */ public void removeCell(Cell cell) { if(cell == null) { throw new IllegalArgumentException("cell must not be null"); } removeCell((HSSFCell)cell, true); } private void removeCell(HSSFCell cell, boolean alsoRemoveRecords) {
HSSFSheet sheet = ... int colToRemove = 5; Iterator rowIter = sheet.iterator(); while (rowIter.hasNext()) { HSSFRow row = (HSSFRow)rowIter.next(); HSSFCell cell = row.getCell(colToRemove); row.removeCell(cell); }
/** * Moves the supplied cell to a new column, which * must not already have a cell there! * @param cell The cell to move * @param newColumn The new column number (0 based) */ public void moveCell(HSSFCell cell, short newColumn) { // Ensure the destination is free if(cells.length > newColumn && cells[newColumn] != null) { throw new IllegalArgumentException("Asked to move cell to column " + newColumn + " but there's already a cell there"); } // Check it's one of ours if(! cells[cell.getColumnIndex()].equals(cell)) { throw new IllegalArgumentException("Asked to move a cell, but it didn't belong to our row"); } // Move the cell to the new position // (Don't remove the records though) removeCell(cell, false); cell.updateCellNum(newColumn); addCell(cell); }
/** * Moves the supplied cell to a new column, which * must not already have a cell there! * @param cell The cell to move * @param newColumn The new column number (0 based) */ public void moveCell(HSSFCell cell, short newColumn) { // Ensure the destination is free if(cells.length > newColumn && cells[newColumn] != null) { throw new IllegalArgumentException("Asked to move cell to column " + newColumn + " but there's already a cell there"); } // Check it's one of ours if(! cells[cell.getColumnIndex()].equals(cell)) { throw new IllegalArgumentException("Asked to move a cell, but it didn't belong to our row"); } // Move the cell to the new position // (Don't remove the records though) removeCell(cell, false); cell.updateCellNum(newColumn); addCell(cell); }
/** * Moves the supplied cell to a new column, which * must not already have a cell there! * @param cell The cell to move * @param newColumn The new column number (0 based) */ public void moveCell(HSSFCell cell, short newColumn) { // Ensure the destination is free if(cells.length > newColumn && cells[newColumn] != null) { throw new IllegalArgumentException("Asked to move cell to column " + newColumn + " but there's already a cell there"); } // Check it's one of ours if(! cells[cell.getColumnIndex()].equals(cell)) { throw new IllegalArgumentException("Asked to move a cell, but it didn't belong to our row"); } // Move the cell to the new position // (Don't remove the records though) removeCell(cell, false); cell.updateCellNum(newColumn); addCell(cell); }
protected void cleanupCells(HSSFSheet resultSheet) { for (int i = resultSheet.getFirstRowNum(); i <= resultSheet.getLastRowNum(); i++) { HSSFRow row = resultSheet.getRow(i); if (row != null) { for (int j = 0; j < row.getLastCellNum(); j++) { HSSFCell cell = row.getCell(j); if (cell != null) { row.removeCell(cell); } } } } }
protected void cleanupCells(HSSFSheet resultSheet) { for (int i = resultSheet.getFirstRowNum(); i <= resultSheet.getLastRowNum(); i++) { HSSFRow row = resultSheet.getRow(i); if (row != null) { for (int j = 0; j < row.getLastCellNum(); j++) { HSSFCell cell = row.getCell(j); if (cell != null) { row.removeCell(cell); } } } } }
row.removeCell(cell); row.removeCell(cell);
row.removeCell(cell); CellValueRecordInterface cellRecord = cell.getCellValueRecord(); cellRecord.setRow(rowNum + n);
row.removeCell( cell ); CellValueRecordInterface cellRecord = cell.getCellValueRecord(); cellRecord.setRow( rowNum + n );
HSSFCell cell = (HSSFCell) cells.next(); HSSFHyperlink link = cell.getHyperlink(); row.removeCell(cell); CellValueRecordInterface cellRecord = cell.getCellValueRecord(); cellRecord.setRow(rowNum + n);