/** * update cell references when shifting rows * * @param n the number of rows to move */ protected void shift(int n) { int rownum = getRowNum() + n; String msg = "Row[rownum=" + getRowNum() + "] contains cell(s) included in a multi-cell array formula. " + "You cannot change part of an array."; for(Cell c : this){ ((XSSFCell)c).updateCellReferencesForShifting(msg); } setRowNum(rownum); }
r.setRowNum(rownum); _rows.put(rownumI, r); return r;
while (ite.hasNext()) { XSSFRow row = (XSSFRow) ite.next(); if (row.getCell(0).toString().equals(controle)) { row.setRowNum(row.getRowNum()+2); } }
/** * update cell references when shifting rows * * @param n the number of rows to move */ protected void shift(int n) { int rownum = getRowNum() + n; String msg = "Row[rownum=" + getRowNum() + "] contains cell(s) included in a multi-cell array formula. " + "You cannot change part of an array."; for(Cell c : this){ ((XSSFCell)c).updateCellReferencesForShifting(msg); } setRowNum(rownum); }
/** * Create a new row within the sheet and return the high level representation * * @param rownum row number * @return High level {@link XSSFRow} object representing a row in the sheet * @see #removeRow(org.apache.poi.ss.usermodel.Row) */ public XSSFRow createRow(int rownum) { CTRow ctRow; XSSFRow prev = _rows.get(rownum); if(prev != null){ ctRow = prev.getCTRow(); ctRow.set(CTRow.Factory.newInstance()); } else { if(_rows.isEmpty() || rownum > _rows.lastKey()) { // we can append the new row at the end ctRow = worksheet.getSheetData().addNewRow(); } else { // get number of rows where row index < rownum // --> this tells us where our row should go int idx = _rows.headMap(rownum).size(); ctRow = worksheet.getSheetData().insertNewRow(idx); } } XSSFRow r = new XSSFRow(ctRow, this); r.setRowNum(rownum); _rows.put(rownum, r); return r; }
r.setRowNum(rownum); _rows.put(rownumI, r); return r;
/** * update cell references when shifting rows * * @param n the number of rows to move */ protected void shift(int n) { int rownum = getRowNum() + n; CalculationChain calcChain = _sheet.getWorkbook().getCalculationChain(); int sheetId = (int)_sheet.sheet.getSheetId(); String msg = "Row[rownum="+getRowNum()+"] contains cell(s) included in a multi-cell array formula. " + "You cannot change part of an array."; for(Cell c : 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()); CTCell ctCell = cell.getCTCell(); String r = new CellReference(rownum, cell.getColumnIndex()).formatAsString(); ctCell.setR(r); } setRowNum(rownum); } }