/** * @param id PivotDataSeparatedCell id that should be merged * @return first row index of all cells that should be merged by common id */ public int getFirstRowById(String id) { int firstRow = PivotExcelExporter.MAX_ROW_INDEX; for (PivotDataSeparatedCell cell : cellsToMerged) { if (cell.getId().equals(id) && firstRow > cell.getIndexRow()) { firstRow = cell.getIndexRow(); } } return firstRow; }
/** * @param id PivotDataSeparatedCell id that should be merged * @return last row index of all cells that should be merged by common id */ public int getLastRowById(String id) { int lastRow = 0; for (PivotDataSeparatedCell cell : cellsToMerged) { if (cell.getId().equals(id) && lastRow < cell.getIndexRow()) { lastRow = cell.getIndexRow(); } } return lastRow; }
protected int createAndAddSeparatedCells(PivotDataSeparatedCell separatedCell, List<PivotDataSeparatedCell> cellsRow) { List<PivotDataSeparatedCell> result = new ArrayList<>(); for (int i = 1; i < separatedCell.getColSpan(); i++) { PivotDataSeparatedCell cell = new PivotDataSeparatedCell(); cell.setId(separatedCell.getId()); cell.setIndexRow(separatedCell.getIndexRow()); cell.setIndexCol(separatedCell.getIndexCol() + i); cell.setColSpan(separatedCell.getColSpan()); cell.setRowSpan(separatedCell.getRowSpan()); cell.setValue(separatedCell.getValue()); cell.setType(separatedCell.getType()); cell.setBold(separatedCell.isBold()); result.add(cell); } cellsRow.add(separatedCell); cellsRow.addAll(result); cellsToMerged.add(separatedCell); cellsToMerged.addAll(result); return result.size(); }
public PivotDataSeparatedCell(PivotDataSeparatedCell cell) { this.id = cell.getId(); this.value = cell.getValue(); this.rowSpan = cell.getRowSpan(); this.colSpan = cell.getColSpan(); this.type = cell.getType(); this.isBold = cell.isBold(); this.indexCol = cell.getIndexCol(); this.indexRow = cell.getIndexRow(); }