Example usage for org.apache.poi.ss.util CellRangeAddress CellRangeAddress

List of usage examples for org.apache.poi.ss.util CellRangeAddress CellRangeAddress

Introduction

In this page you can find the example usage for org.apache.poi.ss.util CellRangeAddress CellRangeAddress.

Prototype

public CellRangeAddress(int firstRow, int lastRow, int firstCol, int lastCol) 

Source Link

Document

Creates new cell range.

Usage

From source file:br.ufpa.psi.comportamente.labgame.relatorios.RelatorioJogadasExperimento.java

License:Open Source License

public InputStream relatorioOntogenese(Long idExp) throws FileNotFoundException, IOException {
    Workbook wb = new XSSFWorkbook();
    Sheet sheet = wb.createSheet("Relatrio Ontognese");

    JogadaDAO jogadaDAO = new JogadaDAO();

    jogadaDAO.beginTransaction();/* ww w  . j  av  a 2 s.co m*/
    List<Jogada> jogadasAux = jogadaDAO.encontrarPorExperimento(idExp);
    jogadaDAO.stopOperation(false);

    ExperimentoDAO expDAO = new ExperimentoDAO();

    expDAO.beginTransaction();
    Experimento experimento = expDAO.find(Experimento.class, idExp);
    expDAO.stopOperation(false);

    JogadorDAO jogDAO = new JogadorDAO();

    jogDAO.beginTransaction();
    List<Jogador> jogadoresTotais = jogDAO.encontraPorExperimento(experimento);
    jogDAO.stopOperation(false);

    //CRIA O CABEALHO "ONTOGNESE
    int quantidadeColunas = 6;
    int quantidadeJogadoresPorCiclo = experimento.getTamanhoFilaJogadores(); //Vai pegar o valor de acordo com o experimento.
    int larguraColuna = 4600;
    int colunaAtual;
    int colunaFinalOntogenese = (quantidadeColunas * quantidadeJogadoresPorCiclo) + 1;

    // --- DEFINE AS PROPRIEDADES DAS CLULAS
    sheet.addMergedRegion(new CellRangeAddress(0, 2, 0, 0));
    sheet.addMergedRegion(new CellRangeAddress(0, 2, 1, 1));
    sheet.setColumnWidth(0, 1500);
    sheet.setColumnWidth(1, 2000);
    sheet.addMergedRegion(new CellRangeAddress(0, 1, 2, colunaFinalOntogenese));
    sheet.addMergedRegion(new CellRangeAddress(1, 2, colunaFinalOntogenese + 1, colunaFinalOntogenese + 1));
    sheet.setColumnWidth(colunaFinalOntogenese + 1, 3000);
    sheet.addMergedRegion(new CellRangeAddress(1, 3, colunaFinalOntogenese + 2, colunaFinalOntogenese + 2));
    sheet.setColumnWidth(colunaFinalOntogenese + 2, 4000);

    // --- FIM

    //for (int i = 0; i < quantidadeJogadoresPorCiclo; i++)
    //if(i == 1){
    sheet.setColumnWidth(2, larguraColuna); // Campo com o nome do participante fica nessa coluna.
    colunaAtual = 2 + quantidadeColunas;
    //} else {
    sheet.setColumnWidth((colunaAtual), larguraColuna);
    colunaAtual += quantidadeColunas;
    sheet.setColumnWidth(colunaAtual, larguraColuna);

    //}
    // ---DEFINE AS CORES DE CADA FONTE
    XSSFFont fonteBranca = (XSSFFont) wb.createFont();
    fonteBranca.setColor(new XSSFColor(Color.WHITE));
    XSSFFont fonteNegra = (XSSFFont) wb.createFont();
    fonteNegra.setColor(new XSSFColor(Color.BLACK));
    XSSFFont fonteVermelha = (XSSFFont) wb.createFont();
    fonteVermelha.setColor(new XSSFColor(Color.RED));

    // --- FIM

    // --- DEFINE ESTILOS CLULAS
    //ESTILO COLUNA LINHA
    XSSFCellStyle estiloColunaLinha = (XSSFCellStyle) wb.createCellStyle();

    estiloColunaLinha.setVerticalAlignment(VerticalAlignment.CENTER);
    estiloColunaLinha.setAlignment(CellStyle.ALIGN_CENTER);
    estiloColunaLinha.setFillForegroundColor(new XSSFColor(Color.LIGHT_GRAY));
    estiloColunaLinha.setFillPattern(CellStyle.SOLID_FOREGROUND);
    estiloColunaLinha.getFont().setBold(true);
    estiloColunaLinha.setBorderBottom(BorderStyle.MEDIUM);
    estiloColunaLinha.setBorderLeft(BorderStyle.MEDIUM);
    estiloColunaLinha.setBorderRight(BorderStyle.MEDIUM);
    estiloColunaLinha.setBorderTop(BorderStyle.MEDIUM);

    XSSFCellStyle estiloColunaColuna = (XSSFCellStyle) wb.createCellStyle();

    estiloColunaColuna.setVerticalAlignment(VerticalAlignment.CENTER);
    estiloColunaColuna.setAlignment(CellStyle.ALIGN_CENTER);
    estiloColunaColuna.getFont().setBold(true);

    //ESTILO CABEALHO
    XSSFCellStyle estiloCabecalhoColunaAB = (XSSFCellStyle) wb.createCellStyle();

    estiloCabecalhoColunaAB.setVerticalAlignment(VerticalAlignment.CENTER);
    estiloCabecalhoColunaAB.setAlignment(CellStyle.ALIGN_CENTER);
    estiloCabecalhoColunaAB.setFillForegroundColor(new XSSFColor(Color.LIGHT_GRAY));
    estiloCabecalhoColunaAB.setFillPattern(CellStyle.SOLID_FOREGROUND);
    estiloCabecalhoColunaAB.getFont().setBold(true);

    XSSFCellStyle estiloCabecalhoColunaP = (XSSFCellStyle) wb.createCellStyle();

    estiloCabecalhoColunaP.setVerticalAlignment(VerticalAlignment.CENTER);
    estiloCabecalhoColunaP.setAlignment(CellStyle.ALIGN_CENTER);
    estiloCabecalhoColunaP.setFont(fonteNegra);
    estiloCabecalhoColunaP.getFont().setBold(true);

    //ESTILO MUDANA DE CICLO
    XSSFCellStyle estiloMudancaCiclo = (XSSFCellStyle) wb.createCellStyle();
    estiloMudancaCiclo.setVerticalAlignment(VerticalAlignment.CENTER);
    estiloMudancaCiclo.setAlignment(CellStyle.ALIGN_CENTER);
    estiloMudancaCiclo.setFillForegroundColor(new XSSFColor(Color.RED));
    estiloMudancaCiclo.setFillPattern(CellStyle.SOLID_FOREGROUND);
    estiloMudancaCiclo.setFont(fonteBranca);

    //ESTILO CICLO SEM MUDANA
    XSSFCellStyle estiloCicloSemMudanca = (XSSFCellStyle) wb.createCellStyle();
    estiloCicloSemMudanca.setVerticalAlignment(VerticalAlignment.CENTER);
    estiloCicloSemMudanca.setAlignment(CellStyle.ALIGN_CENTER);
    estiloCicloSemMudanca.setFont(fonteNegra);

    //ESTILO NOME PARTICIPANTE
    XSSFCellStyle estiloNomeP = (XSSFCellStyle) wb.createCellStyle();
    estiloNomeP.setVerticalAlignment(VerticalAlignment.CENTER);
    estiloNomeP.setAlignment(CellStyle.ALIGN_CENTER);
    estiloNomeP.setBorderBottom(BorderStyle.DOTTED);
    estiloNomeP.setBorderTop(BorderStyle.DOTTED);
    estiloNomeP.setFillForegroundColor(new XSSFColor(Color.BLACK));
    estiloNomeP.setFillPattern(CellStyle.SOLID_FOREGROUND);
    estiloNomeP.setFont(fonteBranca);
    estiloNomeP.getFont().setBold(true);

    //ESTILO ESTABILIDADE
    XSSFCellStyle estiloEstabilidade = (XSSFCellStyle) wb.createCellStyle();
    estiloEstabilidade.setVerticalAlignment(VerticalAlignment.CENTER);
    estiloEstabilidade.setAlignment(CellStyle.ALIGN_CENTER);
    estiloEstabilidade.setFont(fonteVermelha);
    estiloEstabilidade.getFont().setBold(true);

    // --- FIM

    int cr = 0;

    // --- CRIA PRIMEIRA COLUNA (CABEALHO)
    XSSFRow row1 = (XSSFRow) sheet.createRow((short) cr++);

    //CRIA CLULA 1
    XSSFCell c1 = row1.createCell(0);

    c1.setCellValue("FASE");
    c1.setCellStyle(estiloCabecalhoColunaAB);

    //CRIA CLULA 2
    XSSFCell c2 = row1.createCell(1);

    c2.setCellValue("CICLO");
    c2.setCellStyle(estiloCabecalhoColunaAB);

    //CRIA CLULA 3 (ONTOGNESE)
    XSSFCell cOnto = row1.createCell(2);
    cOnto.setCellValue("ONTOGNESE");
    cOnto.setCellStyle(estiloCicloSemMudanca);

    //CRIA CLULA 'CC'
    XSSFRow row2 = (XSSFRow) sheet.createRow(1);
    XSSFCell cCC = row2.createCell(colunaFinalOntogenese + 1);
    cCC.setCellValue("CC");
    cCC.setCellStyle(estiloCicloSemMudanca);

    //CRIA CLULA 'ESTABILIDADE'
    XSSFCell cEstab = row2.createCell(colunaFinalOntogenese + 2);
    cEstab.setCellValue("ESTABILIDADE");
    cEstab.setCellStyle(estiloEstabilidade);

    // --- FIM

    int contadorCelulasCabecalho = 2;
    int contadorAcertosCultural = 0;
    XSSFRow row3 = (XSSFRow) sheet.createRow((short) 2);
    //GERA O CABEALHO DAS JOGADAS
    for (int i = 0; i < experimento.getTamanhoFilaJogadores(); i++) {
        //CRIA CLULA 3 NA LINHA 3
        XSSFCell c3 = row3.createCell(contadorCelulasCabecalho++);

        c3.setCellValue("P");
        c3.setCellStyle(estiloCabecalhoColunaP);

        //CRIA CLULA 4 NA LINHA 3
        XSSFCell c4 = row3.createCell(contadorCelulasCabecalho++);

        c4.setCellValue("Linha");
        c4.setCellStyle(estiloCabecalhoColunaP);

        //CRIA CLULA 5 NA LINHA 3
        XSSFCell c5 = row3.createCell(contadorCelulasCabecalho++);

        c5.setCellValue("Cor");
        c5.setCellStyle(estiloCabecalhoColunaP);

        //CRIA CLULA 6 NA LINHA 3
        XSSFCell c6 = row3.createCell(contadorCelulasCabecalho++);

        c6.setCellValue("Col");
        c6.setCellStyle(estiloCabecalhoColunaP);

        //CRIA CLULA 7 NA LINHA 3
        XSSFCell c7 = row3.createCell(contadorCelulasCabecalho++);

        c7.setCellValue("CI");
        c7.setCellStyle(estiloCabecalhoColunaP);

        //CRIA CLULA 8 NA LINHA 3
        XSSFCell c8 = row3.createCell(contadorCelulasCabecalho++);

        c8.setCellValue("CI Cum");
        c8.setCellStyle(estiloCabecalhoColunaP);

    }

    //VARI?VEIS INICIAIS DA ELABORAO DO RELATRIO
    int quantidadeCiclosTotais = (jogadasAux.size() / experimento.getTamanhoFilaJogadores());
    int contRowJogadas = 4;
    int contadorCiclo = 1;

    //INICIA LISTA DOS JOGADORES POR ORDEM
    List<Jogador> jogadoresAtuais = new ArrayList<>();
    int contOrdem = 1;
    for (int i = 0; i < quantidadeJogadoresPorCiclo; i++) {
        for (Jogador jgdr : jogadoresTotais) {
            if (jgdr.getOrdem() == contOrdem) {
                jogadoresAtuais.add(jgdr);
                contOrdem++;
                break;
            }
        }
    }

    //FAZ A REMOO DO(S) ELEMENTO(S) DA LISTA PRA POUPAR RECURSO EM BUSCA FUTURA
    jogadoresTotais.removeAll(jogadoresAtuais);

    //CRIA INSTNCIA CONTROLE DE PONTUAO CULTURAL
    int pontCulturalCiclo;

    //FOR (JOGADOR : JOGADORES POR CICLO)
    //CRIA LISTA DE CADA JOGADOR AT FIM DO CICLO
    for (int i = 0; i < quantidadeCiclosTotais; i++) {
        //PEGA JOGADAS DO CICLO
        List<Jogada> jogadasCiclo = new ArrayList<>();
        for (Jogada jogada : jogadasAux) {
            if (jogada.getRodada() == i + 1) {
                jogadasCiclo.add(jogada);
                if (jogadasCiclo.size() == quantidadeJogadoresPorCiclo) {
                    break;
                }
            }
        }
        //FAZ A REMOO DO(S) ELEMENTO(S) DA LISTA PRA POUPAR RECURSO EM BUSCA FUTURA
        jogadasAux.removeAll(jogadasCiclo);

        //VERIFICA SE A ORDEM MUDOU
        int contJogadoresIguais = 0;
        List<Jogada> jogadasARemover = new ArrayList<>();
        for (Jogador jogador : jogadoresAtuais) {
            for (Jogada jogada : jogadasCiclo) {
                if (jogada.getJogador().compareTo(jogador) == 0) {
                    jogador.setUltimaJogada(jogada);
                    jogador.incrementaPontuacaoRelatorio();
                    jogadasARemover.add(jogada);
                    contJogadoresIguais++;
                }
            }
        }

        jogadasCiclo.removeAll(jogadasARemover);

        boolean mudouGeracaoCiclo = false;
        if (contJogadoresIguais == quantidadeJogadoresPorCiclo) {
            //CONTINUA COM OS MESMOS JOGADORES
        } else {
            mudouGeracaoCiclo = true;
            Jogador jogadorARemover = new Jogador();
            jogadoresAtuais.remove(0);
            for (Jogador jgdr : jogadoresTotais) {
                if (jgdr.getOrdem() == contOrdem) {
                    //PEGA A PRIMEIRA POSIO PQ ESSA TEM QUE SER A NICA COM ELEMENTO
                    jgdr.setUltimaJogada(jogadasCiclo.get(0));
                    jgdr.incrementaPontuacaoRelatorio();
                    jogadoresAtuais.add(jgdr);
                    contOrdem++;
                    jogadorARemover = jgdr;
                    break;
                }
            }
            jogadoresTotais.remove(jogadorARemover);
        }
        // --- ENCERRA ETAPAS DE VERIFICAO, INICIA A POPULAO DE NOVA LINHA DO XLSX E
        //VERIFICA SE EXISTE PONTUAO CULTURAL.
        int contCellJogadas = 1;
        if (jogadoresAtuais.get(0).getUltimaJogada().getPontuacaoCultural() != 0) {
            pontCulturalCiclo = jogadoresAtuais.get(0).getUltimaJogada().getPontuacaoCultural();
            contadorAcertosCultural++;
        } else {
            pontCulturalCiclo = 0;
        }

        XSSFRow row = (XSSFRow) sheet.createRow((short) contRowJogadas);
        XSSFCell cell = row.createCell(contCellJogadas++);
        //CICLO
        if (contRowJogadas == 4 || mudouGeracaoCiclo == true) {
            //QUANDO HOUVER MUDANA DA GERAO
            cell.setCellValue(contadorCiclo++);
            cell.setCellStyle(estiloMudancaCiclo);
        } else {
            cell.setCellValue(contadorCiclo++);
            cell.setCellStyle(estiloCicloSemMudanca);
        }

        for (int j = 0; j < quantidadeJogadoresPorCiclo; j++) {

            //P
            XSSFCell cell1 = row.createCell(contCellJogadas++);
            cell1.setCellValue(jogadoresAtuais.get(j).getNome());
            cell1.setCellStyle(estiloNomeP);

            //Linha
            XSSFCell cell2 = row.createCell(contCellJogadas++);
            cell2.setCellValue(jogadoresAtuais.get(j).getUltimaJogada().getLinhaSelecionada());
            cell2.setCellStyle(estiloColunaLinha);

            //Cor
            XSSFCell cell3 = row.createCell(contCellJogadas++);
            cell3.setCellValue(jogadoresAtuais.get(j).getUltimaJogada().getCorSelecionada());
            cell3.setCellStyle(EstiloCelula.retornaEstilo(
                    jogadoresAtuais.get(j).getUltimaJogada().getCorSelecionada(), wb, fonteBranca, fonteNegra));

            //Col
            XSSFCell cell4 = row.createCell(contCellJogadas++);
            cell4.setCellValue(jogadoresAtuais.get(j).getUltimaJogada().getColunaSelecionada());
            cell4.setCellStyle(estiloColunaColuna);

            //CI
            XSSFCell cell5 = row.createCell(contCellJogadas++);
            cell5.setCellValue(jogadoresAtuais.get(j).getUltimaJogada().getPontuacaoIndividual());
            cell5.setCellStyle(estiloColunaColuna);

            //CI Cum
            XSSFCell cell6 = row.createCell(contCellJogadas++);
            cell6.setCellValue(jogadoresAtuais.get(j).getPontuacaoExibidaRelatorio());
            cell6.setCellStyle(estiloColunaColuna);
        }
        //CC
        XSSFCell cell7 = row.createCell(contCellJogadas++);
        cell7.setCellValue(pontCulturalCiclo);
        cell7.setCellStyle(estiloCabecalhoColunaAB);

        // ESTABILIDADE
        XSSFCell cell8 = row.createCell(contCellJogadas);
        cell8.setCellValue((contadorAcertosCultural * 100) / (i + 1) + "%");
        cell8.setCellStyle(estiloColunaColuna);

        contRowJogadas++;
    }

    //ESCREVE O ARQUIVO
    byte[] bytes;
    try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
        wb.write(out);
        bytes = out.toByteArray();
    }
    return new ByteArrayInputStream(bytes);
}

From source file:cn.afterturn.easypoi.excel.export.ExcelExportService.java

License:Apache License

/**
 * /* w w w  . j av  a2 s .  co m*/
 */
private int createHeaderRow(ExportParams title, Sheet sheet, Workbook workbook, int index,
        List<ExcelExportEntity> excelParams, int cellIndex) {
    Row row = sheet.getRow(index) == null ? sheet.createRow(index) : sheet.getRow(index);
    int rows = getRowNums(excelParams, true);
    row.setHeight(title.getHeaderHeight());
    Row listRow = null;
    if (rows >= 2) {
        listRow = sheet.createRow(index + 1);
        listRow.setHeight(title.getHeaderHeight());
    }
    int groupCellLength = 0;
    CellStyle titleStyle = getExcelExportStyler().getTitleStyle(title.getColor());
    for (int i = 0, exportFieldTitleSize = excelParams.size(); i < exportFieldTitleSize; i++) {
        ExcelExportEntity entity = excelParams.get(i);
        // ?groupName???
        if (StringUtils.isBlank(entity.getGroupName()) || i == 0
                || !entity.getGroupName().equals(excelParams.get(i - 1).getGroupName())) {
            if (groupCellLength > 1) {
                sheet.addMergedRegion(
                        new CellRangeAddress(index, index, cellIndex - groupCellLength, cellIndex - 1));
            }
            groupCellLength = 0;
        }
        if (StringUtils.isNotBlank(entity.getGroupName())) {
            createStringCell(row, cellIndex, entity.getGroupName(), titleStyle, entity);
            createStringCell(listRow, cellIndex, entity.getName(), titleStyle, entity);
            groupCellLength++;
        } else if (StringUtils.isNotBlank(entity.getName())) {
            createStringCell(row, cellIndex, entity.getName(), titleStyle, entity);
        }
        if (entity.getList() != null) {
            // ???
            int tempCellIndex = cellIndex;
            cellIndex = createHeaderRow(title, sheet, workbook, rows == 1 ? index : index + 1, entity.getList(),
                    cellIndex);
            List<ExcelExportEntity> sTitel = entity.getList();
            if (StringUtils.isNotBlank(entity.getName()) && sTitel.size() > 1) {
                PoiMergeCellUtil.addMergedRegion(sheet, index, index, tempCellIndex,
                        tempCellIndex + sTitel.size() - 1);
            }
            /*for (int j = 0, size = sTitel.size(); j < size; j++) {
                    
            createStringCell(rows == 2 ? listRow : row, cellIndex, sTitel.get(j).getName(),
                    titleStyle, entity);
            cellIndex++;
            }*/
            cellIndex--;
        } else if (rows > 1 && StringUtils.isBlank(entity.getGroupName())) {
            createStringCell(listRow, cellIndex, "", titleStyle, entity);
            PoiMergeCellUtil.addMergedRegion(sheet, index, index + rows - 1, cellIndex, cellIndex);
        }
        cellIndex++;
    }
    if (groupCellLength > 1) {
        PoiMergeCellUtil.addMergedRegion(sheet, index, index, cellIndex - groupCellLength, cellIndex - 1);
    }
    return cellIndex;

}

From source file:cn.afterturn.easypoi.excel.export.template.ExcelExportOfTemplateUtil.java

License:Apache License

private void setForEeachRowCellValue(boolean isCreate, Row row, int columnIndex, Object t,
        List<ExcelForEachParams> columns, Map<String, Object> map, int rowspan, int colspan,
        MergedRegionHelper mergedRegionHelper) throws Exception {
    //cell??/* w  w w  .  j a  v a  2  s.c o m*/
    for (int i = 0; i < rowspan; i++) {
        int size = columns.size();//?
        for (int j = columnIndex, max = columnIndex + colspan; j < max; j++) {
            if (row.getCell(j) == null) {
                row.createCell(j);
                CellStyle style = row.getRowNum() % 2 == 0
                        ? getStyles(false, size <= j - columnIndex ? null : columns.get(j - columnIndex))
                        : getStyles(true, size <= j - columnIndex ? null : columns.get(j - columnIndex));
                //styler??,?Excel,??Excel?
                if (style != null) {
                    row.getCell(j).setCellStyle(style);
                }
            }

        }
        if (i < rowspan - 1) {
            row = row.getSheet().getRow(row.getRowNum() + 1);
        }
    }
    //?
    ExcelForEachParams params;
    row = row.getSheet().getRow(row.getRowNum() - rowspan + 1);
    for (int k = 0; k < rowspan; k++) {
        int ci = columnIndex;
        short high = columns.get(0).getHeight();
        int n = k;
        while (n > 0) {
            if (columns.get(n * colspan).getHeight() == 0) {
                n--;
            } else {
                high = columns.get(n * colspan).getHeight();
                break;
            }
        }
        row.setHeight(high);
        for (int i = 0; i < colspan && i < columns.size(); i++) {
            boolean isNumber = false;
            params = columns.get(colspan * k + i);
            tempCreateCellSet.add(row.getRowNum() + "_" + (ci));
            if (params == null) {
                continue;
            }
            if (StringUtils.isEmpty(params.getName()) && StringUtils.isEmpty(params.getConstValue())) {
                row.getCell(ci).setCellStyle(params.getCellStyle());
                ci = ci + params.getColspan();
                continue;
            }
            String val = null;
            Object obj = null;
            //??
            if (StringUtils.isEmpty(params.getName())) {
                val = params.getConstValue();
            } else {
                String tempStr = new String(params.getName());
                if (isNumber(tempStr)) {
                    isNumber = true;
                    tempStr = tempStr.replaceFirst(NUMBER_SYMBOL, "");
                }
                map.put(teplateParams.getTempParams(), t);
                obj = eval(tempStr, map);
                val = obj.toString();
            }
            if (obj != null && obj instanceof ImageEntity) {
                ImageEntity img = (ImageEntity) obj;
                row.getCell(ci).setCellValue("");
                if (img.getRowspan() > 1 || img.getColspan() > 1) {
                    img.setHeight(0);
                    row.getCell(ci).getSheet()
                            .addMergedRegion(new CellRangeAddress(row.getCell(ci).getRowIndex(),
                                    row.getCell(ci).getRowIndex() + img.getRowspan() - 1,
                                    row.getCell(ci).getColumnIndex(),
                                    row.getCell(ci).getColumnIndex() + img.getColspan() - 1));
                }
                createImageCell(row.getCell(ci), img.getHeight(), img.getRowspan(), img.getColspan(),
                        img.getUrl(), img.getData());
            } else if (isNumber && StringUtils.isNotEmpty(val)) {
                row.getCell(ci).setCellValue(Double.parseDouble(val));
            } else {
                try {
                    row.getCell(ci).setCellValue(val);
                } catch (Exception e) {
                    LOGGER.error(e.getMessage(), e);
                }
            }
            if (params.getCellStyle() != null) {
                row.getCell(ci).setCellStyle(params.getCellStyle());
            }
            //??
            if (params.isNeedSum()) {
                templateSumHandler.addValueOfKey(params.getName(), val);
            }
            //??,?????
            setMergedRegionStyle(row, ci, params);
            //??
            if ((params.getRowspan() != 1 || params.getColspan() != 1)
                    && !mergedRegionHelper.isMergedRegion(row.getRowNum() + 1, ci)
                    && PoiCellUtil.isMergedRegion(row.getSheet(), row.getRowNum(), ci)) {
                PoiMergeCellUtil.addMergedRegion(row.getSheet(), row.getRowNum(),
                        row.getRowNum() + params.getRowspan() - 1, ci, ci + params.getColspan() - 1);
            }
            ci = ci + params.getColspan();
        }
        row = row.getSheet().getRow(row.getRowNum() + 1);
    }

}

From source file:cn.bzvs.excel.export.base.ExcelExportBase.java

License:Apache License

/**
 *  ? Cells/*from w w  w  . j  ava 2 s.c  o m*/
 *
 * @param patriarch
 * @param index
 * @param t
 * @param excelParams
 * @param sheet
 * @param workbook
 * @param rowHeight
 * @return
 * @throws Exception
 */
public int createCells(Drawing patriarch, int index, Object t, List<ExcelExportEntity> excelParams, Sheet sheet,
        Workbook workbook, short rowHeight) throws Exception {
    ExcelExportEntity entity;
    Row row = sheet.createRow(index);
    row.setHeight(rowHeight);
    int maxHeight = 1, cellNum = 0;
    int indexKey = createIndexCell(row, index, excelParams.get(0));
    cellNum += indexKey;
    for (int k = indexKey, paramSize = excelParams.size(); k < paramSize; k++) {
        entity = excelParams.get(k);
        if (entity.getList() != null) {
            Collection<?> list = getListCellValue(entity, t);
            int listC = 0;
            if (list != null && list.size() > 0) {
                for (Object obj : list) {
                    createListCells(patriarch, index + listC, cellNum, obj, entity.getList(), sheet, workbook);
                    listC++;
                }
            }
            cellNum += entity.getList().size();
            if (list != null && list.size() > maxHeight) {
                maxHeight = list.size();
            }
        } else {
            Object value = getCellValue(entity, t);
            if (entity.getType() == BaseEntityTypeConstants.StringType) {
                createStringCell(row, cellNum++, value == null ? "" : value.toString(),
                        index % 2 == 0 ? getStyles(false, entity) : getStyles(true, entity), entity);
                if (entity.isHyperlink()) {
                    row.getCell(cellNum - 1).setHyperlink(dataHanlder.getHyperlink(
                            row.getSheet().getWorkbook().getCreationHelper(), t, entity.getName(), value));
                }
            } else if (entity.getType() == BaseEntityTypeConstants.DoubleType) {
                createDoubleCell(row, cellNum++, value == null ? "" : value.toString(),
                        index % 2 == 0 ? getStyles(false, entity) : getStyles(true, entity), entity);
                if (entity.isHyperlink()) {
                    row.getCell(cellNum - 1).setHyperlink(dataHanlder.getHyperlink(
                            row.getSheet().getWorkbook().getCreationHelper(), t, entity.getName(), value));
                }
            } else {
                createImageCell(patriarch, entity, row, cellNum++, value == null ? "" : value.toString(), t);
            }
        }
    }
    // ????
    cellNum = 0;
    for (int k = indexKey, paramSize = excelParams.size(); k < paramSize; k++) {
        entity = excelParams.get(k);
        if (entity.getList() != null) {
            cellNum += entity.getList().size();
        } else if (entity.isNeedMerge()) {
            for (int i = index + 1; i < index + maxHeight; i++) {
                sheet.getRow(i).createCell(cellNum);
                sheet.getRow(i).getCell(cellNum).setCellStyle(getStyles(false, entity));
            }
            sheet.addMergedRegion(new CellRangeAddress(index, index + maxHeight - 1, cellNum, cellNum));
            cellNum++;
        }
    }
    return maxHeight;

}

From source file:cn.bzvs.excel.export.ExcelExportServer.java

License:Apache License

/**
 *  ?/*from  ww w.j  a v  a2 s.  co  m*/
 * 
 * @param entity
 * @param sheet
 * @param workbook
 * @param feildWidth
 */
public int createHeaderRow(ExportParams entity, Sheet sheet, Workbook workbook, int feildWidth) {
    Row row = sheet.createRow(0);
    row.setHeight(entity.getTitleHeight());
    createStringCell(row, 0, entity.getTitle(), getExcelExportStyler().getHeaderStyle(entity.getHeaderColor()),
            null);
    for (int i = 1; i <= feildWidth; i++) {
        createStringCell(row, i, "", getExcelExportStyler().getHeaderStyle(entity.getHeaderColor()), null);
    }
    sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, feildWidth));
    if (entity.getSecondTitle() != null) {
        row = sheet.createRow(1);
        row.setHeight(entity.getSecondTitleHeight());
        CellStyle style = workbook.createCellStyle();
        style.setAlignment(CellStyle.ALIGN_RIGHT);
        createStringCell(row, 0, entity.getSecondTitle(), style, null);
        for (int i = 1; i <= feildWidth; i++) {
            createStringCell(row, i, "", getExcelExportStyler().getHeaderStyle(entity.getHeaderColor()), null);
        }
        sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, feildWidth));
        return 2;
    }
    return 1;
}

From source file:cn.bzvs.excel.export.ExcelExportServer.java

License:Apache License

/**
 * //from  w  w w.  j  av a2 s.  c o  m
 * 
 * @param title
 * @param index
 */
private int createTitleRow(ExportParams title, Sheet sheet, Workbook workbook, int index,
        List<ExcelExportEntity> excelParams) {
    Row row = sheet.createRow(index);
    int rows = getRowNums(excelParams);
    row.setHeight((short) 450);
    Row listRow = null;
    if (rows == 2) {
        listRow = sheet.createRow(index + 1);
        listRow.setHeight((short) 450);
    }
    int cellIndex = 0;
    CellStyle titleStyle = getExcelExportStyler().getTitleStyle(title.getColor());
    for (int i = 0, exportFieldTitleSize = excelParams.size(); i < exportFieldTitleSize; i++) {
        ExcelExportEntity entity = excelParams.get(i);
        if (StringUtils.isNotBlank(entity.getName())) {
            createStringCell(row, cellIndex, entity.getName(), titleStyle, entity);
        }
        if (entity.getList() != null) {
            List<ExcelExportEntity> sTitel = entity.getList();
            if (StringUtils.isNotBlank(entity.getName())) {
                sheet.addMergedRegion(
                        new CellRangeAddress(index, index, cellIndex, cellIndex + sTitel.size() - 1));
            }
            for (int j = 0, size = sTitel.size(); j < size; j++) {
                createStringCell(rows == 2 ? listRow : row, cellIndex, sTitel.get(j).getName(), titleStyle,
                        entity);
                cellIndex++;
            }
            cellIndex--;
        } else if (rows == 2) {
            createStringCell(listRow, cellIndex, "", titleStyle, entity);
            sheet.addMergedRegion(new CellRangeAddress(index, index + 1, cellIndex, cellIndex));
        }
        cellIndex++;
    }
    return rows;

}

From source file:cn.bzvs.excel.export.template.ExcelExportOfTemplateUtil.java

License:Apache License

private void setForEeachRowCellValue(boolean isCreate, Row row, int columnIndex, Object t,
        List<ExcelForEachParams> columns, Map<String, Object> map, int rowspan, int colspan,
        MergedRegionHelper mergedRegionHelper) throws Exception {
    //cell??//from   www .j  a v a2 s  . c  om
    for (int i = 0; i < rowspan; i++) {
        int size = columns.size();//?
        for (int j = columnIndex, max = columnIndex + colspan; j < max; j++) {
            if (row.getCell(j) == null) {
                row.createCell(j);
                CellStyle style = row.getRowNum() % 2 == 0
                        ? getStyles(false, size >= j - columnIndex ? null : columns.get(j - columnIndex))
                        : getStyles(true, size >= j - columnIndex ? null : columns.get(j - columnIndex));
                //styler??,?Excel,??Excel?
                if (style != null)
                    row.getCell(j).setCellStyle(style);
            }

        }
        if (i < rowspan - 1) {
            row = row.getSheet().getRow(row.getRowNum() + 1);
        }
    }
    //?
    ExcelForEachParams params;
    row = row.getSheet().getRow(row.getRowNum() - rowspan + 1);
    for (int k = 0; k < rowspan; k++) {
        int ci = columnIndex;//cell??
        row.setHeight(columns.get(0 * colspan).getHeight());
        for (int i = 0; i < colspan && i < columns.size(); i++) {
            boolean isNumber = false;
            params = columns.get(colspan * k + i);
            tempCreateCellSet.add(row.getRowNum() + "_" + (ci));
            if (params == null) {
                continue;
            }
            if (StringUtils.isEmpty(params.getName()) && StringUtils.isEmpty(params.getConstValue())) {
                row.getCell(ci).setCellStyle(columns.get(i).getCellStyle());
                ci = ci + columns.get(i).getColspan();
                continue;
            }
            String val = null;
            //??
            if (StringUtils.isEmpty(params.getName())) {
                val = params.getConstValue();
            } else {
                String tempStr = new String(params.getName());
                if (isNumber(tempStr)) {
                    isNumber = true;
                    tempStr = tempStr.replaceFirst(NUMBER_SYMBOL, "");
                }
                map.put(teplateParams.getTempParams(), t);
                val = eval(tempStr, map).toString();
            }
            if (isNumber && StringUtils.isNotEmpty(val)) {
                row.getCell(ci).setCellValue(Double.parseDouble(val));
                row.getCell(ci).setCellType(Cell.CELL_TYPE_NUMERIC);
            } else {
                try {
                    row.getCell(ci).setCellValue(val);
                } catch (Exception e) {
                    e.getMessage();
                }
            }
            row.getCell(ci).setCellStyle(columns.get(i).getCellStyle());
            //??
            if (params.isNeedSum()) {
                templateSumHanlder.addValueOfKey(params.getName(), val);
            }
            //??,?????
            setMergedRegionStyle(row, ci, columns.get(i));
            //??
            if ((params.getRowspan() != 1 || params.getColspan() != 1)
                    && !mergedRegionHelper.isMergedRegion(row.getRowNum() + 1, ci)) {
                row.getSheet().addMergedRegion(new CellRangeAddress(row.getRowNum(),
                        row.getRowNum() + params.getRowspan() - 1, ci, ci + params.getColspan() - 1));
            }
            ci = ci + params.getColspan();
        }
        row = row.getSheet().getRow(row.getRowNum() + 1);
    }

}

From source file:co.turnus.analysis.data.bottlenecks.io.XlsAlgoBottlenecksDataWriter.java

License:Open Source License

private void writeActionActorClassTable(HSSFWorkbook workbook, HotspotsDataAnalyser analyzer) {
    HSSFSheet sheet = workbook.createSheet("<Action, ActorClass>");
    // Action Actor Class Results
    Cell cell = sheet.createRow(0).createCell(0);
    HSSFRichTextString title = new HSSFRichTextString("Action and Actor Class Results");
    title.applyFont(titleFont);/*from w ww.  ja  v  a2s. c  o  m*/
    cell.setCellValue(title);

    Row row = sheet.createRow(1);
    sheet.addMergedRegion(new CellRangeAddress(1, 3, 0, 0));
    row.createCell(0).setCellValue("Action");
    sheet.addMergedRegion(new CellRangeAddress(1, 3, 1, 1));
    row.createCell(1).setCellValue("Actor Class");

    sheet.addMergedRegion(new CellRangeAddress(1, 1, 2, 7));
    row.createCell(2).setCellValue("Total Executions");
    sheet.addMergedRegion(new CellRangeAddress(1, 1, 8, 12));
    row.createCell(8).setCellValue("Non Deferrable Executions");
    sheet.addMergedRegion(new CellRangeAddress(1, 1, 13, 17));
    row.createCell(13).setCellValue("Critical Executions");

    row = sheet.createRow(2);
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 2, 3));
    row.createCell(2).setCellValue("Executions");
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 4, 6));
    row.createCell(4).setCellValue("Clock Cycles");
    row.createCell(7).setCellValue("Slack");
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 8, 9));
    row.createCell(8).setCellValue("Executions");
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 10, 12));
    row.createCell(10).setCellValue("Clock Cycles");
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 13, 14));
    row.createCell(13).setCellValue("Executions");
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 15, 17));
    row.createCell(15).setCellValue("Clock Cycles");

    row = sheet.createRow(3);
    row.createCell(2).setCellValue("%");
    row.createCell(3).setCellValue("abs");
    row.createCell(4).setCellValue("%");
    row.createCell(5).setCellValue("mean");
    row.createCell(6).setCellValue("variance");
    row.createCell(7).setCellValue("min");
    row.createCell(8).setCellValue("%");
    row.createCell(9).setCellValue("abs");
    row.createCell(10).setCellValue("%");
    row.createCell(11).setCellValue("mean");
    row.createCell(12).setCellValue("variance");
    row.createCell(13).setCellValue("%");
    row.createCell(14).setCellValue("abs");
    row.createCell(15).setCellValue("%");
    row.createCell(16).setCellValue("mean");
    row.createCell(17).setCellValue("variance");

    Table<ActorClass, Action, ExtendExecData> cTable = analyzer.getSumDataTable(ActorClass.class,
            Key.CRITICAL_CLOCKCYCLES, Order.DECREASING);

    // row index
    int rowi = 4;
    for (Table.Cell<ActorClass, Action, ExtendExecData> entry : cTable.cellSet()) {

        row = sheet.createRow(rowi);
        rowi++;

        row.createCell(0).setCellValue(entry.getColumnKey().getId());
        row.createCell(1).setCellValue(entry.getRowKey().getName());

        ExtendExecData exec = entry.getValue();
        cell = row.createCell(2);
        cell.setCellFormula("D" + rowi + "/Summary!A14*100");
        row.createCell(3).setCellValue(exec.getTotalExec().getExecutions());
        cell = row.createCell(4);
        cell.setCellFormula("F" + rowi + "/Summary!B14*100");
        row.createCell(5).setCellValue(exec.getTotalExec().getClockCyclesMean());
        row.createCell(6).setCellValue(exec.getTotalExec().getClockCyclesVariance());

        double slack = exec.getSlack().getMin();
        slack = slack > AnalysisUtil.PRECISION_EPS ? slack : 0.0;
        row.createCell(7).setCellValue(slack);
        cell = row.createCell(8);
        cell.setCellFormula("J" + rowi + "/Summary!E14*100");
        row.createCell(9).setCellValue(exec.getNotDeferrableExec().getExecutions());
        cell = row.createCell(10);
        cell.setCellFormula("L" + rowi + "/Summary!G14*100");
        row.createCell(11).setCellValue(exec.getNotDeferrableExec().getClockCyclesMean());
        row.createCell(12).setCellValue(exec.getNotDeferrableExec().getClockCyclesVariance());
        cell = row.createCell(13);
        cell.setCellFormula("O" + rowi + "/Summary!J14*100");
        row.createCell(14).setCellValue(exec.getCriticalExec().getExecutions());
        cell = row.createCell(15);
        cell.setCellFormula("Q" + rowi + "/Summary!L14*100");
        row.createCell(16).setCellValue(exec.getCriticalExec().getClockCyclesMean());
        row.createCell(17).setCellValue(exec.getCriticalExec().getClockCyclesVariance());
    }
}

From source file:co.turnus.analysis.data.bottlenecks.io.XlsAlgoBottlenecksDataWriter.java

License:Open Source License

private void writeActionActorTable(HSSFWorkbook workbook, HotspotsDataAnalyser analyzer) {
    HSSFSheet sheet = workbook.createSheet("<Action, Actor>");
    // Action Actor Results
    Cell cell = sheet.createRow(0).createCell(0);
    HSSFRichTextString title = new HSSFRichTextString("Action and Actor Results");
    title.applyFont(titleFont);/*from ww  w  .j  av a  2s.  co m*/
    cell.setCellValue(title);
    Row row = sheet.createRow(1);
    sheet.addMergedRegion(new CellRangeAddress(1, 3, 0, 0));
    row.createCell(0).setCellValue("Action");
    sheet.addMergedRegion(new CellRangeAddress(1, 3, 1, 1));
    row.createCell(1).setCellValue("Actor");

    sheet.addMergedRegion(new CellRangeAddress(1, 1, 2, 9));
    row.createCell(2).setCellValue("Total Executions");
    sheet.addMergedRegion(new CellRangeAddress(1, 1, 10, 14));
    row.createCell(10).setCellValue("Non Deferrable Executions");
    sheet.addMergedRegion(new CellRangeAddress(1, 1, 15, 19));
    row.createCell(15).setCellValue("Critical Executions");

    row = sheet.createRow(2);
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 2, 3));
    row.createCell(2).setCellValue("Executions");
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 4, 6));
    row.createCell(4).setCellValue("Clock Cycles");
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 7, 9));
    row.createCell(7).setCellValue("Slack");
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 10, 11));
    row.createCell(10).setCellValue("Executions");
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 12, 14));
    row.createCell(12).setCellValue("Clock Cycles");
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 15, 16));
    row.createCell(15).setCellValue("Executions");
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 17, 19));
    row.createCell(17).setCellValue("Clock Cycles");

    row = sheet.createRow(3);
    row.createCell(2).setCellValue("%");
    row.createCell(3).setCellValue("abs");
    row.createCell(4).setCellValue("%");
    row.createCell(5).setCellValue("mean");
    row.createCell(6).setCellValue("variance");
    row.createCell(7).setCellValue("min");
    row.createCell(8).setCellValue("average");
    row.createCell(9).setCellValue("variance");
    row.createCell(10).setCellValue("%");
    row.createCell(11).setCellValue("abs");
    row.createCell(12).setCellValue("%");
    row.createCell(13).setCellValue("mean");
    row.createCell(14).setCellValue("variance");
    row.createCell(15).setCellValue("%");
    row.createCell(16).setCellValue("abs");
    row.createCell(17).setCellValue("%");
    row.createCell(18).setCellValue("mean");
    row.createCell(19).setCellValue("variance");

    Table<Actor, Action, ExtendExecData> aTable = analyzer.getSumDataTable(Actor.class,
            Key.CRITICAL_CLOCKCYCLES, Order.DECREASING);

    // row index
    int rowi = 4;
    for (Table.Cell<Actor, Action, ExtendExecData> entry : aTable.cellSet()) {
        row = sheet.createRow(rowi);
        rowi++;

        row.createCell(0).setCellValue(entry.getColumnKey().getId());
        row.createCell(1).setCellValue(entry.getRowKey().getId());

        ExtendExecData exec = entry.getValue();
        cell = row.createCell(2);
        cell.setCellFormula("D" + rowi + "/Summary!A14*100");
        row.createCell(3).setCellValue(exec.getTotalExec().getExecutions());
        cell = row.createCell(4);
        cell.setCellFormula("F" + rowi + "/Summary!B14*100");
        row.createCell(5).setCellValue(exec.getTotalExec().getClockCyclesMean());
        row.createCell(6).setCellValue(exec.getTotalExec().getClockCyclesVariance());

        double slack = exec.getSlack().getMin();
        slack = slack > AnalysisUtil.PRECISION_EPS ? slack : 0.0;
        row.createCell(7).setCellValue(slack);
        double slackAvg = exec.getSlack().getMean();
        slackAvg = slackAvg > AnalysisUtil.PRECISION_EPS ? slackAvg : 0.0;
        row.createCell(8).setCellValue(slackAvg);
        double slackVar = exec.getSlack().getVariance();
        slackVar = slackVar > AnalysisUtil.PRECISION_EPS ? slackVar : 0.0;
        row.createCell(9).setCellValue(slackVar);
        cell = row.createCell(10);
        cell.setCellFormula("L" + rowi + "/Summary!E14*100");
        row.createCell(11).setCellValue(exec.getNotDeferrableExec().getExecutions());
        cell = row.createCell(12);
        cell.setCellFormula("N" + rowi + "/Summary!G14*100");
        row.createCell(13).setCellValue(exec.getNotDeferrableExec().getClockCyclesMean());
        row.createCell(14).setCellValue(exec.getNotDeferrableExec().getClockCyclesVariance());
        cell = row.createCell(15);
        cell.setCellFormula("Q" + rowi + "/Summary!J14*100");
        row.createCell(16).setCellValue(exec.getCriticalExec().getExecutions());
        cell = row.createCell(17);
        cell.setCellFormula("S" + rowi + "/Summary!L14*100");
        row.createCell(18).setCellValue(exec.getCriticalExec().getClockCyclesMean());
        row.createCell(19).setCellValue(exec.getCriticalExec().getClockCyclesVariance());

    }

}

From source file:co.turnus.analysis.data.bottlenecks.io.XlsAlgoBottlenecksDataWriter.java

License:Open Source License

private void writeActorClassesTable(HSSFWorkbook workbook, HotspotsDataAnalyser analyzer) {
    HSSFSheet sheet = workbook.createSheet("ActorClasses");

    // Actor classes Results
    Cell cell = sheet.createRow(0).createCell(0);
    HSSFRichTextString title = new HSSFRichTextString("ActorClasses Results");
    title.applyFont(titleFont);/*from ww w.j  a  v a  2 s .c  o  m*/
    cell.setCellValue(title);

    Row row = sheet.createRow(1);
    sheet.addMergedRegion(new CellRangeAddress(1, 3, 0, 0));
    row.createCell(0).setCellValue("Class");
    sheet.addMergedRegion(new CellRangeAddress(1, 3, 1, 1));
    row.createCell(1).setCellValue("File");
    sheet.addMergedRegion(new CellRangeAddress(1, 2, 2, 3));
    row.createCell(2).setCellValue("Version");

    sheet.addMergedRegion(new CellRangeAddress(1, 1, 4, 8));
    row.createCell(4).setCellValue("Total Executions");
    sheet.addMergedRegion(new CellRangeAddress(1, 1, 9, 13));
    row.createCell(9).setCellValue("Non Deferrable Executions");
    sheet.addMergedRegion(new CellRangeAddress(1, 1, 14, 18));
    row.createCell(14).setCellValue("Critical Executions");

    row = sheet.createRow(2);
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 4, 5));
    row.createCell(4).setCellValue("Executions");
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 6, 8));
    row.createCell(6).setCellValue("Clock Cycles");
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 9, 10));
    row.createCell(9).setCellValue("Executions");
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 11, 13));
    row.createCell(11).setCellValue("Clock Cycles");
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 14, 15));
    row.createCell(14).setCellValue("Executions");
    sheet.addMergedRegion(new CellRangeAddress(2, 2, 16, 18));
    row.createCell(16).setCellValue("Clock Cycles");

    row = sheet.createRow(3);
    row.createCell(2).setCellValue("ID");
    row.createCell(3).setCellValue("Last Modification");
    row.createCell(4).setCellValue("%");
    row.createCell(5).setCellValue("abs");
    row.createCell(6).setCellValue("%");
    row.createCell(7).setCellValue("mean");
    row.createCell(8).setCellValue("variance");
    row.createCell(9).setCellValue("%");
    row.createCell(10).setCellValue("abs");
    row.createCell(11).setCellValue("%");
    row.createCell(12).setCellValue("mean");
    row.createCell(13).setCellValue("variance");
    row.createCell(14).setCellValue("%");
    row.createCell(15).setCellValue("abs");
    row.createCell(16).setCellValue("%");
    row.createCell(17).setCellValue("mean");
    row.createCell(18).setCellValue("variance");

    Map<ActorClass, ExtendExecData> cMap = analyzer.getSumDataMap(ActorClass.class, Key.CRITICAL_CLOCKCYCLES,
            Order.DECREASING);

    // row index
    int rowi = 4;
    for (Entry<ActorClass, ExtendExecData> entry : cMap.entrySet()) {
        ActorClass clazz = entry.getKey();
        ExtendExecData exec = entry.getValue();

        row = sheet.createRow(rowi);
        rowi++;

        row.createCell(0).setCellValue(clazz.getName());
        row.createCell(1).setCellValue(clazz.getSourceFile());
        row.createCell(2).setCellValue(clazz.getVersion().getId());
        cell = row.createCell(3);
        cell.setCellValue(clazz.getVersion().getLastModificationDate());
        cell.setCellStyle(cellStyle);
        cell = row.createCell(4);
        cell.setCellFormula("F" + rowi + "/Summary!A14*100");
        row.createCell(5).setCellValue(exec.getTotalExec().getExecutions());
        cell = row.createCell(6);
        cell.setCellFormula("H" + rowi + "/Summary!B14*100");
        row.createCell(7).setCellValue(exec.getTotalExec().getClockCyclesMean());
        row.createCell(8).setCellValue(exec.getTotalExec().getClockCyclesVariance());
        cell = row.createCell(9);
        cell.setCellFormula("K" + rowi + "/Summary!E14*100");
        row.createCell(10).setCellValue(exec.getNotDeferrableExec().getExecutions());
        cell = row.createCell(11);
        cell.setCellFormula("M" + rowi + "/Summary!G14*100");
        row.createCell(12).setCellValue(exec.getNotDeferrableExec().getClockCyclesMean());
        row.createCell(13).setCellValue(exec.getNotDeferrableExec().getClockCyclesVariance());
        cell = row.createCell(14);
        cell.setCellFormula("P" + rowi + "/Summary!J14*100");
        row.createCell(15).setCellValue(exec.getCriticalExec().getExecutions());
        cell = row.createCell(16);
        cell.setCellFormula("R" + rowi + "/Summary!L14*100");
        row.createCell(17).setCellValue(exec.getCriticalExec().getClockCyclesMean());
        row.createCell(18).setCellValue(exec.getCriticalExec().getClockCyclesVariance());

    }

}