private void initRows(CTWorksheet worksheetParam) { _rows.clear(); tables = new TreeMap<>(); sharedFormulas = new HashMap<>(); arrayFormulas = new ArrayList<>(); for (CTRow row : worksheetParam.getSheetData().getRowArray()) { XSSFRow r = new XSSFRow(row, this); // Performance optimization: explicit boxing is slightly faster than auto-unboxing, though may use more memory final Integer rownumI = Integer.valueOf(r.getRowNum()); // NOSONAR _rows.put(rownumI, r); } }
XSSFRow r = new XSSFRow(ctRow, this); r.setRowNum(rownum); _rows.put(rownumI, r);
@SuppressWarnings("deprecation") //YK: getXYZArray() array accessors are deprecated in xmlbeans with JDK 1.5 support private void initRows(CTWorksheet worksheet) { _rows = new TreeMap<Integer, XSSFRow>(); tables = new TreeMap<String, XSSFTable>(); sharedFormulas = new HashMap<Integer, CTCellFormula>(); arrayFormulas = new ArrayList<CellRangeAddress>(); for (CTRow row : worksheet.getSheetData().getRowArray()) { XSSFRow r = new XSSFRow(row, this); _rows.put(r.getRowNum(), r); } }
private void initRows(CTWorksheet worksheetParam) { _rows.clear(); tables = new TreeMap<>(); sharedFormulas = new HashMap<>(); arrayFormulas = new ArrayList<>(); for (CTRow row : worksheetParam.getSheetData().getRowArray()) { XSSFRow r = new XSSFRow(row, this); // Performance optimization: explicit boxing is slightly faster than auto-unboxing, though may use more memory final Integer rownumI = Integer.valueOf(r.getRowNum()); // NOSONAR _rows.put(rownumI, r); } }
/** * 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; }
XSSFRow r = new XSSFRow(ctRow, this); r.setRowNum(rownum); _rows.put(rownumI, r);