Example usage for org.apache.poi.xssf.usermodel XSSFWorkbook getSheetAt

List of usage examples for org.apache.poi.xssf.usermodel XSSFWorkbook getSheetAt

Introduction

In this page you can find the example usage for org.apache.poi.xssf.usermodel XSSFWorkbook getSheetAt.

Prototype

@Override
public XSSFSheet getSheetAt(int index) 

Source Link

Document

Get the XSSFSheet object at the given index.

Usage

From source file:com.accenture.control.ExtraiPlanilha.java

public List<CasoTesteTemp> verificaCTsPlanilha(String planilha)
        throws SQLException, ClassNotFoundException, FileNotFoundException, IOException {

    List<CasoTesteTemp> listPlano = new ArrayList<CasoTesteTemp>();

    ManipulaDados md = new ManipulaDados();
    ManipulaDadosSQLite bdLite = new ManipulaDadosSQLite();
    //capturando arquivo recebido 
    FileInputStream arquivo = new FileInputStream(new File(planilha));
    System.out.println(planilha);
    XSSFWorkbook workbook = new XSSFWorkbook(arquivo);

    XSSFSheet sheetAlunos = workbook.getSheetAt(1);
    int linha = 7;
    int numCelula = 1;

    Row row = sheetAlunos.getRow(linha);

    Cell celCasoTeste = row.getCell(12);

    while (!celCasoTeste.getStringCellValue().equals("")) {
        Plano p = new Plano();
        row = sheetAlunos.getRow(linha);

        celCasoTeste = row.getCell(12);//from  w w  w  . j  av  a2  s  . c  o  m

        System.out.println("Caso de Teste: " + celCasoTeste.getStringCellValue());

        celCasoTeste = row.getCell(12);

    }

    arquivo.close();

    return listPlano;
}

From source file:com.accenture.control.ExtraiPlanilha.java

public void extraiConfPlanilha(String diretorio) throws IOException, ClassNotFoundException, SQLException {

    boolean existedados = false;
    ManipulaDadosSQLite bdLite = new ManipulaDadosSQLite();
    FileInputStream arquivo;// www. ja  va 2s .  com

    arquivo = new FileInputStream(new File(diretorio));

    System.out.println(diretorio);
    XSSFWorkbook workbook = new XSSFWorkbook(arquivo);

    XSSFSheet sheetConf = workbook.getSheetAt(2);
    int linha = 7;
    int numCelula = 1;

    //Capturando dados da Complexidade na celula A1
    int i = 1;
    CellReference cellReference = new CellReference("A" + i);
    Row row = sheetConf.getRow(cellReference.getRow());
    Cell cell = row.getCell(cellReference.getCol());
    System.out.println(cell.getStringCellValue());

    i++;
    bdLite.deletaTabelaConf("TB_COMPLEXIDADE");

    while (cell != null) {
        cellReference = new CellReference("A" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());
        System.out.println(cell.getStringCellValue());
        existedados = true;
        bdLite.insertTabelaConf("TB_COMPLEXIDADE", "DESC_COMPLEXIDADE", cell.getStringCellValue());
        i++;
        cellReference = new CellReference("A" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());

    }

    bdLite.deletaTabelaConf("TB_AUTOMATIZAVEL");
    //Capturando dados Automatizvel na celula A7
    i = 7;
    cellReference = new CellReference("A" + i);
    row = sheetConf.getRow(cellReference.getRow());
    cell = row.getCell(cellReference.getCol());
    System.out.println(cell.getStringCellValue());

    bdLite.deletaTabelaConf("TB_AUTOMATIZAVEL");

    i++;
    while (cell != null) {
        cellReference = new CellReference("A" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());
        System.out.println(cell.getStringCellValue());
        existedados = true;
        bdLite.insertTabelaConf("TB_AUTOMATIZAVEL", "DESC_AUTOMATIZAVEL", cell.getStringCellValue());
        i++;
        cellReference = new CellReference("A" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());

    }

    //Capturando dados type
    i = 12;
    cellReference = new CellReference("A" + i);
    row = sheetConf.getRow(cellReference.getRow());
    cell = row.getCell(cellReference.getCol());
    System.out.println(cell.getStringCellValue());

    bdLite.deletaTabelaConf("TB_TYPE");

    i++;
    while (cell != null) {
        cellReference = new CellReference("A" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());
        System.out.println(cell.getStringCellValue());
        existedados = true;
        bdLite.insertTabelaConf("TB_TYPE", "DESC_TYPE", cell.getStringCellValue());
        i++;
        cellReference = new CellReference("A" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());

    }

    //Capturando dados TRG
    i = 17;
    cellReference = new CellReference("A" + i);
    row = sheetConf.getRow(cellReference.getRow());
    cell = row.getCell(cellReference.getCol());
    System.out.println(cell.getStringCellValue());

    bdLite.deletaTabelaConf("TB_TRG");

    i++;
    while (cell != null) {
        cellReference = new CellReference("A" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());
        System.out.println(cell.getStringCellValue());
        existedados = true;
        bdLite.insertTabelaConf("TB_TRG", "DESC_TRG", cell.getStringCellValue());
        i++;
        cellReference = new CellReference("A" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());

    }

    //Capturando dados CADEIA
    i = 17;
    cellReference = new CellReference("A" + i);
    row = sheetConf.getRow(cellReference.getRow());
    cell = row.getCell(cellReference.getCol());
    System.out.println(cell.getStringCellValue());

    bdLite.deletaTabelaConf("TB_CADEIA");

    i++;
    while (cell != null) {
        cellReference = new CellReference("A" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());
        System.out.println(cell.getStringCellValue());
        existedados = true;
        bdLite.insertTabelaConf("TB_CADEIA", "DESC_CADEIA", cell.getStringCellValue());
        i++;
        cellReference = new CellReference("A" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());

    }

    //Capturando dados TP REQUISITO
    i = 32;
    cellReference = new CellReference("A" + i);
    row = sheetConf.getRow(cellReference.getRow());
    cell = row.getCell(cellReference.getCol());
    System.out.println(cell.getStringCellValue());

    bdLite.deletaTabelaConf("TB_TP_REQUISITO");

    i++;
    while (cell != null) {
        cellReference = new CellReference("A" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());
        System.out.println(cell.getStringCellValue());
        existedados = true;
        bdLite.insertTabelaConf("TB_TP_REQUISITO", "DESC_TP_REQUISITO", cell.getStringCellValue());
        i++;
        cellReference = new CellReference("A" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());

    }

    //Capturando dados criao/alterao
    i = 27;
    cellReference = new CellReference("A" + i);
    row = sheetConf.getRow(cellReference.getRow());
    cell = row.getCell(cellReference.getCol());
    System.out.println(cell.getStringCellValue());

    bdLite.deletaTabelaConf("TB_CRIACAO");

    i++;
    while (cell != null) {
        cellReference = new CellReference("A" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());
        System.out.println(cell.getStringCellValue());
        existedados = true;
        bdLite.insertTabelaConf("TB_CRIACAO", "DESC_CRIACAO", cell.getStringCellValue());
        i++;
        cellReference = new CellReference("A" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());

    }

    //Capturando dados SISTEMA MASTER
    i = 1;
    cellReference = new CellReference("C" + i);
    row = sheetConf.getRow(cellReference.getRow());
    cell = row.getCell(cellReference.getCol());
    System.out.println(cell.getStringCellValue());

    bdLite.deletaTabelaConf("TB_SISTEMA_MASTER");

    i++;
    while (cell != null) {
        cellReference = new CellReference("C" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());
        System.out.println(cell.getStringCellValue());
        existedados = true;
        bdLite.insertTabelaConf("TB_SISTEMA_MASTER", "DESC_SISTEMA_MASTER", cell.getStringCellValue());
        i++;
        cellReference = new CellReference("C" + i);
        row = sheetConf.getRow(cellReference.getRow());
        if (row == null) {
            cell = null;
        } else {
            cell = row.getCell(cellReference.getCol(), row.RETURN_BLANK_AS_NULL);
        }

    }

    //Capturando dados FUNCIONALIDADE
    i = 1;
    cellReference = new CellReference("E" + i);
    row = sheetConf.getRow(cellReference.getRow());
    cell = row.getCell(cellReference.getCol());
    System.out.println(cell.getStringCellValue());

    bdLite.deletaTabelaConf("TB_FUNCIONALIDADE");

    i++;
    while (cell != null) {
        cellReference = new CellReference("E" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());
        System.out.println(cell.getStringCellValue());
        existedados = true;
        bdLite.insertTabelaConf("TB_FUNCIONALIDADE", "DESC_FUNCIONALIDADE", cell.getStringCellValue());
        i++;
        cellReference = new CellReference("E" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());

    }

    //Capturando dados CENARIO INTEGRADO
    i = 1;
    cellReference = new CellReference("G" + i);
    row = sheetConf.getRow(cellReference.getRow());
    cell = row.getCell(cellReference.getCol());
    System.out.println(cell.getStringCellValue());

    bdLite.deletaTabelaConf("TB_CENARIO_INTEGRADO");

    i++;
    while (cell != null) {
        cellReference = new CellReference("G" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());
        System.out.println(cell.getStringCellValue());
        existedados = true;
        bdLite.insertTabelaConf("TB_CENARIO_INTEGRADO", "DESC_CENARIO_INTEGRADO", cell.getStringCellValue());
        i++;
        cellReference = new CellReference("G" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());

    }

    if (existedados == true) {
        bdLite.insertVersaCarga(sheetConf.getSheetName());
    }

}

From source file:com.accenture.control.ExtraiPlanilha.java

public static void gravaCTPlanilha(List<Plano> plano, String panilha, int linhaCelula)
        throws FileNotFoundException, IOException, InvalidFormatException, SQLException,
        ClassNotFoundException {//from   w  w  w. java 2  s  . c  om
    ManipulaDadosSQLite banco = new ManipulaDadosSQLite();
    //recebe a planilha e atribui a variavel arquivo
    FileInputStream arquivo = new FileInputStream(new File(panilha));
    System.out.println(panilha);
    //instacia um workbook passando arquivo como paramentro
    XSSFWorkbook workbook = new XSSFWorkbook(arquivo);

    XSSFSheet sheetPlano = workbook.getSheetAt(1);
    String cadeia = "B", segmento = "C", produto = "D", funcionalidade = "E", cenarioItegrado = "F",
            sistemaMaster = "G", sistemasEnvolvidos = "H", fornecedor = "I", tpRequisito = "J", requisito = "K",
            cenarioTeste = "L", casoTeste = "M", descricao = "N", nomeStep = "P", descricaoStep = "Q",
            resultadoEsperado = "R", cenarioAuto = "U", type = "V", trg = "W", subject = "X", criacao = "Y";
    CellReference cellReference = new CellReference("B8");
    //     Row row = sheetPlano.getRow(cellReference.getRow());
    //     Cell cell = row.getCell(cellReference.getCol());

    int tamanhoLista = plano.size();
    int numeroCelula = 8;

    int linha = linhaCelula;
    int celula = 12;

    Row row = sheetPlano.getRow(linha);
    Cell cell;//= row.getCell(celula);
    Cell celCadeia = row.getCell(1);
    Cell celSegmento = row.getCell(2);
    Cell celProduto = row.getCell(3);
    Cell celFuncionalidade = row.getCell(4);
    Cell celCenarioIntegracao = row.getCell(5);
    Cell celSistemaMaster = row.getCell(6);
    Cell celSistemaEnvolvidos = row.getCell(7);
    Cell celFornecedor = row.getCell(8);
    Cell celTpRequisito = row.getCell(9);
    Cell celRequisito = row.getCell(10);
    Cell celCenario = row.getCell(11);
    Cell celCasoTeste = row.getCell(12);
    Cell celDescricao = row.getCell(13);
    Cell celQtdSistemas = row.getCell(19);
    Cell celCenarioAuto = row.getCell(21);
    Cell celType = row.getCell(22);
    Cell celTrg = row.getCell(23);
    Cell celSubject = row.getCell(24);
    Cell celCriacao = row.getCell(25);
    Cell celStep = row.getCell(16);

    Step steps = new Step();

    for (int i = 0; i < tamanhoLista; i++) {

        row = sheetPlano.getRow(linha);

        celCadeia = row.getCell(1);
        celSegmento = row.getCell(2);
        celProduto = row.getCell(3);
        celFuncionalidade = row.getCell(4);
        celCenarioIntegracao = row.getCell(5);
        celSistemaMaster = row.getCell(6);
        celSistemaEnvolvidos = row.getCell(7);
        celFornecedor = row.getCell(8);
        celTpRequisito = row.getCell(9);
        celRequisito = row.getCell(10);
        celCenario = row.getCell(11);
        celCasoTeste = row.getCell(12);
        celDescricao = row.getCell(13);
        Cell celComplexidade = row.getCell(15);
        celQtdSistemas = row.getCell(19);
        Cell celQtdStep = row.getCell(20);
        celCenarioAuto = row.getCell(21);
        celType = row.getCell(22);
        celTrg = row.getCell(23);
        celSubject = row.getCell(24);
        celCriacao = row.getCell(25);

        celCadeia.setCellValue(plano.get(i).getCadeia());
        celSegmento.setCellValue(plano.get(i).getSegmento());
        celProduto.setCellValue(plano.get(i).getProduto());
        celFuncionalidade.setCellValue(plano.get(i).getFuncionalidade());
        celCenarioIntegracao.setCellValue(plano.get(i).getCenarioIntegrado());
        celSistemaMaster.setCellValue(plano.get(i).getSistemaMaster());
        celSistemaEnvolvidos.setCellValue(plano.get(i).getSistemasEnvolvidos());
        celFornecedor.setCellValue(plano.get(i).getFornecedor());
        celTpRequisito.setCellValue(plano.get(i).getTpRequisito());
        celRequisito.setCellValue(plano.get(i).getRequisito());
        celCenario.setCellValue(plano.get(i).getCenarioTeste());
        celCasoTeste.setCellValue(plano.get(i).getCasoTeste());
        celDescricao.setCellValue(plano.get(i).getDescCasoTeste());
        String formulaComplexibilidade = celComplexidade.getCellFormula();
        celComplexidade.setCellFormula(formulaComplexibilidade);
        celQtdSistemas.setCellValue(plano.get(i).getQtdSistemas());
        String formulaQtdStep = celQtdStep.getCellFormula();
        celQtdStep.setCellFormula(formulaQtdStep);
        celCenarioAuto.setCellValue(plano.get(i).getCenarioAutomatizavel());
        celType.setCellValue(plano.get(i).getType());
        celTrg.setCellValue(plano.get(i).getTrg());
        celSubject.setCellValue(plano.get(i).getSubject());
        celCriacao.setCellValue(plano.get(i).getCriacaoAlteracao());

        celStep = row.getCell(16);

        row = sheetPlano.getRow(linha);
        //            celCasoTeste = row.getCell(12);
        int linhaStep = linha;

        List<Plano> listPlanos = banco.selectPlanoPorId(plano.get(i));

        List<Step> listStep = banco.getStepPorPlano(plano.get(i));

        int linhaLimpeza = linha;
        //limpa as clulas de step
        for (int cont = 0; cont <= 24; cont++) {

            Cell celNomeStep = row.getCell(16);
            Cell celDescStep = row.getCell(17);
            Cell celResultadoStep = row.getCell(18);

            String valor = null;
            celNomeStep.setCellValue(valor);
            celDescStep.setCellValue(valor);
            celResultadoStep.setCellValue(valor);

            linhaLimpeza = linhaLimpeza + 1;

            row = sheetPlano.getRow(linhaLimpeza);

        }
        //fim
        row = sheetPlano.getRow(linha);
        int tamanho = listStep.size();
        int idTemp = 0;
        for (int cont = 0; cont < tamanho; cont++) {

            //                   if(idTemp != listPlanos.get(cont).getStep().getId()){
            //                    model.addRow(new String[]{String.valueOf(listPlanos.get(cont).getStep().getNomeStep()), listPlanos.get(cont).getStep().getDescStep(),
            //                        listPlanos.get(cont).getStep().getResultadoStep(), String.valueOf(listPlanos.get(cont).getStep().getId())});
            //                   }
            Cell celNomeStep = row.getCell(16);
            Cell celDescStep = row.getCell(17);
            Cell celResultadoStep = row.getCell(18);

            celNomeStep.setCellValue(listStep.get(cont).getNomeStep());
            celDescStep.setCellValue(listStep.get(cont).getDescStep());
            celResultadoStep.setCellValue(listStep.get(cont).getResultadoStep());

            //caso o ct seja alterao pinta os steps de amarelo - inicio
            if (plano.get(i).getCriacaoAlteracao().equals("Alterao")) {
                Color color = new XSSFColor(java.awt.Color.yellow);
                //                    XSSFCellStyle style = workbook.createCellStyle();
                //                    style.setBorderTop((short) 6); // double lines border
                //                    style.setBorderBottom((short) 1); // single line border
                //                    style.setFillBackgroundColor(IndexedColors.YELLOW.getIndex());
                //                    
                //                    celNomeStep.setCellStyle(style);
            }
            //fim

            linhaStep = linhaStep + 1;

            row = sheetPlano.getRow(linhaStep);
            celStep = row.getCell(16);

            idTemp = listPlanos.get(cont).getId();
        }

        linha = linha + 25;
        row = sheetPlano.getRow(linha);
        cell = celCadeia;

    }

    FileOutputStream fileOut = new FileOutputStream(new File(panilha));
    workbook.write(fileOut);
    fileOut.close();
}

From source file:com.accenture.control.ExtraiPlanilha.java

public void exportTStoTI(List<TesteCaseTSBean> testCases, String planilha) throws FileNotFoundException,
        IOException, InvalidFormatException, SQLException, ClassNotFoundException {

    copySheet(new File("C:\\FastPlan\\sheets\\TI.xlsx"), new File(planilha));

    //recebe a planilha e atribui a variavel arquivo
    FileInputStream arquivo = new FileInputStream(new File(planilha));
    System.out.println(planilha);
    //instacia um workbook passando arquivo como paramentro
    XSSFWorkbook workbook = new XSSFWorkbook(arquivo);

    XSSFSheet sheetPlano = workbook.getSheetAt(1);

    //     Row row = sheetPlano.getRow(cellReference.getRow());
    //     Cell cell = row.getCell(cellReference.getCol());

    int tamanhoLista = testCases.size();
    int numeroCelula = 8;

    int linha = 7;
    int celula = 12;

    Row row = sheetPlano.getRow(linha);/*from w w w .j av  a2 s .com*/
    Cell cell;//= row.getCell(celula);
    Cell celCadeia = row.getCell(1);
    Cell celSegmento = row.getCell(2);
    Cell celProduto = row.getCell(3);
    Cell celFuncionalidade = row.getCell(4);
    Cell celCenarioIntegracao = row.getCell(5);
    Cell celSistemaMaster = row.getCell(6);
    Cell celSistemaEnvolvidos = row.getCell(7);
    Cell celFornecedor = row.getCell(8);
    Cell celTpRequisito = row.getCell(9);
    Cell celRequisito = row.getCell(10);
    Cell celCenario = row.getCell(11);
    Cell celCasoTeste = row.getCell(12);
    Cell celDescricao = row.getCell(13);
    Cell celQtdSistemas = row.getCell(19);
    Cell celCenarioAuto = row.getCell(21);
    Cell celType = row.getCell(22);
    Cell celTrg = row.getCell(23);
    Cell celSubject = row.getCell(24);
    Cell celCriacao = row.getCell(25);
    Cell celStep = row.getCell(16);

    Step steps = new Step();

    for (int i = 0; i < tamanhoLista; i++) {

        testCases.get(i)
                .setTestScriptName(testCases.get(i).getTestScriptName().replaceAll("\\d\\d.\\d\\d-", ""));

        for (int j = 0; j < testCases.get(i).getParameters().size(); j++) {

            if (testCases.get(i).getTestScriptDescription()
                    .contains(testCases.get(i).getParameters().get(j).getParameterValue())) {
                testCases.get(i)
                        .setTestScriptDescription(testCases.get(i).getTestScriptDescription().replace(
                                "<" + testCases.get(i).getParameters().get(j).getParameterValue() + ">",
                                "<<<" + testCases.get(i).getParameters().get(j).getParameterName() + ">>>"));
            }
        }

        row = sheetPlano.getRow(linha);

        celCadeia = row.getCell(1);
        celSegmento = row.getCell(2);
        celProduto = row.getCell(3);
        celFuncionalidade = row.getCell(4);
        celCenarioIntegracao = row.getCell(5);
        celSistemaMaster = row.getCell(6);
        celSistemaEnvolvidos = row.getCell(7);
        celFornecedor = row.getCell(8);
        celTpRequisito = row.getCell(9);
        celRequisito = row.getCell(10);
        celCenario = row.getCell(11);
        celCasoTeste = row.getCell(12);
        celDescricao = row.getCell(13);
        Cell celComplexidade = row.getCell(15);
        celQtdSistemas = row.getCell(19);
        Cell celQtdStep = row.getCell(20);
        celCenarioAuto = row.getCell(21);
        celType = row.getCell(22);
        celTrg = row.getCell(23);
        celSubject = row.getCell(24);
        celCriacao = row.getCell(25);

        celCadeia.setCellValue("");
        celSegmento.setCellValue("");
        celProduto.setCellValue("");
        celFuncionalidade.setCellValue("");
        celCenarioIntegracao.setCellValue("");
        celSistemaMaster.setCellValue(testCases.get(i).getProduct());
        celSistemaEnvolvidos.setCellValue(testCases.get(i).getProduct());
        celFornecedor.setCellValue("Accenture");
        celTpRequisito.setCellValue("");
        celRequisito.setCellValue("");
        celCenario.setCellValue(testCases.get(i).getTestScriptName());
        celCasoTeste.setCellValue(testCases.get(i).getTestScriptName());
        celDescricao.setCellValue(testCases.get(i).getTestScriptDescription());
        String formulaComplexibilidade = celComplexidade.getCellFormula();
        celComplexidade.setCellFormula(formulaComplexibilidade);
        celQtdSistemas.setCellValue(1);
        String formulaQtdStep = celQtdStep.getCellFormula();
        celQtdStep.setCellFormula(formulaQtdStep);
        celCenarioAuto.setCellValue("Sim");
        celType.setCellValue("Manual");
        celTrg.setCellValue("No");
        celSubject.setCellValue("");
        celCriacao.setCellValue("Criao");

        celStep = row.getCell(16);

        row = sheetPlano.getRow(linha);
        //            celCasoTeste = row.getCell(12);
        int linhaStep = linha;

        row = sheetPlano.getRow(linha);
        int tamanho = testCases.get(i).getListStep().size();
        int idTemp = 0;
        for (int cont = 0; cont < tamanho; cont++) {

            //                   if(idTemp != listPlanos.get(cont).getStep().getId()){
            //                    model.addRow(new String[]{String.valueOf(listPlanos.get(cont).getStep().getNomeStep()), listPlanos.get(cont).getStep().getDescStep(),
            //                        listPlanos.get(cont).getStep().getResultadoStep(), String.valueOf(listPlanos.get(cont).getStep().getId())});
            //                   }
            Cell celNomeStep = row.getCell(16);
            Cell celDescStep = row.getCell(17);
            Cell celResultadoStep = row.getCell(18);

            for (int j = 0; j < testCases.get(i).getParameters().size(); j++) {

                if (testCases.get(i).getListStep().get(cont).getDescStep()
                        .contains(testCases.get(i).getParameters().get(j).getParameterValue())) {
                    testCases.get(i).getListStep().get(cont)
                            .setDescStep(testCases.get(i).getListStep().get(cont).getDescStep().replace(
                                    "<" + testCases.get(i).getParameters().get(j).getParameterValue() + ">",
                                    "<<<" + testCases.get(i).getParameters().get(j).getParameterName()
                                            + ">>>"));
                }

                if (testCases.get(i).getListStep().get(cont).getResultadoStep()
                        .contains(testCases.get(i).getParameters().get(j).getParameterValue())) {
                    testCases.get(i).getListStep().get(cont).setResultadoStep(
                            testCases.get(i).getListStep().get(cont).getResultadoStep().replace(
                                    "<" + testCases.get(i).getParameters().get(j).getParameterValue() + ">",
                                    "<<<" + testCases.get(i).getParameters().get(j).getParameterName()
                                            + ">>>"));
                }

            }

            testCases.get(i).getListStep().get(cont).setNomeStep("Step " + (cont + 1));

            celNomeStep.setCellValue(testCases.get(i).getListStep().get(cont).getNomeStep());
            celDescStep.setCellValue(testCases.get(i).getListStep().get(cont).getDescStep());
            celResultadoStep.setCellValue(testCases.get(i).getListStep().get(cont).getResultadoStep());

            linhaStep = linhaStep + 1;

            row = sheetPlano.getRow(linhaStep);
            celStep = row.getCell(16);

        }

        linha = linha + 25;
        row = sheetPlano.getRow(linha);
        cell = celCadeia;

    }

    FileOutputStream fileOut = new FileOutputStream(new File(planilha));
    workbook.write(fileOut);
    fileOut.close();
}

From source file:com.accenture.control.ExtraiPlanilha.java

/**
 * Mtodo para sobrescrever ct na planilha * com o ct existente em uma
 * determinada linha ser substituido */*from ww  w  . ja v a2s . c  o m*/
 *
 * @author Raphael Coelho
 *
 * @param Plano - objeto plano
 * @param String - caminho da planilha
 * @param int - nmero da linha que est o ct na planilha
 *
 * @return void
 *
 */
public static void gravaCTPlanilha(Plano plano, String panilha, int linhaCelula) throws FileNotFoundException,
        IOException, InvalidFormatException, SQLException, ClassNotFoundException {

    /**
     * Exemplo bsico de um comentrio em JavaDoc
     */
    //recebe a planilha e atribui a variavel arquivo
    FileInputStream arquivo = new FileInputStream(new File(panilha));
    System.out.println(panilha);
    //instacia um workbook passando arquivo como paramentro
    ManipulaDadosSQLite banco = new ManipulaDadosSQLite();
    XSSFWorkbook workbook = new XSSFWorkbook(arquivo);

    XSSFSheet sheetPlano = workbook.getSheetAt(1);

    CellReference cellReference = new CellReference("B8");
    //     Row row = sheetPlano.getRow(cellReference.getRow());
    //     Cell cell = row.getCell(cellReference.getCol());

    //        int tamanhoLista = plano.size();
    int numeroCelula = 8;

    int linha = linhaCelula;
    int celula = 12;

    Row row = sheetPlano.getRow(linha);
    Cell cell;//= row.getCell(celula);
    Cell celCadeia = row.getCell(1);
    Cell celSegmento = row.getCell(2);
    Cell celProduto = row.getCell(3);
    Cell celFuncionalidade = row.getCell(4);
    Cell celCenarioIntegracao = row.getCell(5);
    Cell celSistemaMaster = row.getCell(6);
    Cell celSistemaEnvolvidos = row.getCell(7);
    Cell celFornecedor = row.getCell(8);
    Cell celTpRequisito = row.getCell(9);
    Cell celRequisito = row.getCell(10);
    Cell celCenario = row.getCell(11);
    Cell celCasoTeste = row.getCell(12);
    Cell celDescricao = row.getCell(13);
    Cell celQtdSistemas = row.getCell(19);
    Cell celCenarioAuto = row.getCell(21);
    Cell celType = row.getCell(22);
    Cell celTrg = row.getCell(23);
    Cell celSubject = row.getCell(24);
    Cell celCriacao = row.getCell(25);
    Cell celStep = row.getCell(16);

    Step steps = new Step();

    row = sheetPlano.getRow(linha);

    celCadeia = row.getCell(1);
    celSegmento = row.getCell(2);
    celProduto = row.getCell(3);
    celFuncionalidade = row.getCell(4);
    celCenarioIntegracao = row.getCell(5);
    celSistemaMaster = row.getCell(6);
    celSistemaEnvolvidos = row.getCell(7);
    celFornecedor = row.getCell(8);
    celTpRequisito = row.getCell(9);
    celRequisito = row.getCell(10);
    celCenario = row.getCell(11);
    celCasoTeste = row.getCell(12);
    celDescricao = row.getCell(13);
    Cell celComplexidade = row.getCell(15);
    celQtdSistemas = row.getCell(19);
    Cell celQtdStep = row.getCell(20);
    celCenarioAuto = row.getCell(21);
    celType = row.getCell(22);
    celTrg = row.getCell(23);
    celSubject = row.getCell(24);
    celCriacao = row.getCell(25);

    celCadeia.setCellValue(plano.getCadeia());
    celSegmento.setCellValue(plano.getSegmento());
    celProduto.setCellValue(plano.getProduto());
    celFuncionalidade.setCellValue(plano.getFuncionalidade());
    celCenarioIntegracao.setCellValue(plano.getCenarioIntegrado());
    celSistemaMaster.setCellValue(plano.getSistemaMaster());
    celSistemaEnvolvidos.setCellValue(plano.getSistemasEnvolvidos());
    celFornecedor.setCellValue(plano.getFornecedor());
    celTpRequisito.setCellValue(plano.getTpRequisito());
    celRequisito.setCellValue(plano.getRequisito());
    celCenario.setCellValue(plano.getCenarioTeste());
    celCasoTeste.setCellValue(plano.getCasoTeste());
    celDescricao.setCellValue(plano.getDescCasoTeste());
    String formulaComplexibilidade = celComplexidade.getCellFormula();
    celComplexidade.setCellFormula(formulaComplexibilidade);
    celQtdSistemas.setCellValue(plano.getQtdSistemas());
    String formulaQtdStep = celQtdStep.getCellFormula();
    celQtdStep.setCellFormula(formulaQtdStep);
    celCenarioAuto.setCellValue(plano.getCenarioAutomatizavel());
    celType.setCellValue(plano.getType());
    celTrg.setCellValue(plano.getTrg());
    celSubject.setCellValue(plano.getSubject());
    celCriacao.setCellValue(plano.getCriacaoAlteracao());

    celStep = row.getCell(16);

    row = sheetPlano.getRow(linha);
    //            celCasoTeste = row.getCell(12);
    int linhaStep = linha;

    List<Plano> listPlanos = banco.selectPlanoPorId(plano);

    List<Step> listStep = banco.getStepPorPlano(plano);

    int linhaLimpeza = linha;
    //limpa as clulas de step
    for (int cont = 0; cont <= 24; cont++) {

        Cell celNomeStep = row.getCell(16);
        Cell celDescStep = row.getCell(17);
        Cell celResultadoStep = row.getCell(18);
        String valor = null;
        celNomeStep.setCellValue(valor);
        celDescStep.setCellValue(valor);
        celResultadoStep.setCellValue(valor);

        linhaLimpeza = linhaLimpeza + 1;

        row = sheetPlano.getRow(linhaLimpeza);

    }
    //fim
    row = sheetPlano.getRow(linha);
    int tamanho = listStep.size();
    int idTemp = 0;
    for (int cont = 0; cont < tamanho; cont++) {

        //                   if(idTemp != listPlanos.get(cont).getStep().getId()){
        //                    model.addRow(new String[]{String.valueOf(listPlanos.get(cont).getStep().getNomeStep()), listPlanos.get(cont).getStep().getDescStep(),
        //                        listPlanos.get(cont).getStep().getResultadoStep(), String.valueOf(listPlanos.get(cont).getStep().getId())});
        //                   }
        Cell celNomeStep = row.getCell(16);
        Cell celDescStep = row.getCell(17);
        Cell celResultadoStep = row.getCell(18);

        celNomeStep.setCellValue(listStep.get(cont).getNomeStep());
        celDescStep.setCellValue(listStep.get(cont).getDescStep());
        celResultadoStep.setCellValue(listStep.get(cont).getResultadoStep());
        //caso o ct seja alterao pinta os steps de amarelo - inicio
        if (plano.getCriacaoAlteracao().equals("Alterao")) {
            Color color = new XSSFColor(java.awt.Color.yellow);
            //                    XSSFCellStyle style = workbook.createCellStyle();
            //                    style.setBorderTop((short) 6); // double lines border
            //                    style.setBorderBottom((short) 1); // single line border
            //                    style.setFillBackgroundColor((XSSFColor) color);
            //                    
            //                    celNomeStep.setCellStyle(style);
        }
        //fim
        linhaStep = linhaStep + 1;

        row = sheetPlano.getRow(linhaStep);
        celStep = row.getCell(16);

        idTemp = listPlanos.get(cont).getId();
    }

    linha = linha + 25;
    row = sheetPlano.getRow(linha);
    cell = celCadeia;

    FileOutputStream fileOut = new FileOutputStream(new File(panilha));
    workbook.write(fileOut);
    fileOut.close();
}

From source file:com.accenture.control.ImportaDadosConf.java

public int getQtdDadosConf(String diretorio) throws FileNotFoundException, IOException {

    FileInputStream arquivo;/*from w w  w .ja v a  2s  .c  o m*/
    arquivo = new FileInputStream(new File(diretorio));
    //
    XSSFWorkbook workbook = new XSSFWorkbook(arquivo);
    //Selecionando a planilha de configuraes
    XSSFSheet sheetConf = workbook.getSheetAt(2);
    int linha = 7;
    int numCelula = 1;
    int i = 1;

    //Caontando COmplexidade
    CellReference cellReference = new CellReference("A" + i);
    Row row = sheetConf.getRow(cellReference.getRow());
    Cell cell = row.getCell(cellReference.getCol());

    while (cell != null) {
        cellReference = new CellReference("A" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());
        System.out.println(cell.getStringCellValue());
        texto1.paintAll(texto1.getGraphics());
        texto1.setText("Importando itens de configurao: " + cell.getStringCellValue());
        texto1.paintAll(texto1.getGraphics());

        i++;
        cellReference = new CellReference("A" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());

        qtdConf++;

    }

    i = 7;
    cellReference = new CellReference("A" + i);
    row = sheetConf.getRow(cellReference.getRow());
    cell = row.getCell(cellReference.getCol());
    System.out.println(cell.getStringCellValue());

    i++;
    while (cell != null) {
        cellReference = new CellReference("A" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());
        System.out.println(cell.getStringCellValue());
        texto1.paintAll(texto1.getGraphics());
        texto1.setText("Importando itens de configurao: " + cell.getStringCellValue());
        texto1.paintAll(texto1.getGraphics());

        i++;
        cellReference = new CellReference("A" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());

        qtdConf++;

    }

    //Capturando dados type
    i = 12;
    cellReference = new CellReference("A" + i);
    row = sheetConf.getRow(cellReference.getRow());
    cell = row.getCell(cellReference.getCol());
    System.out.println(cell.getStringCellValue());

    i++;
    while (cell != null) {
        cellReference = new CellReference("A" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());
        System.out.println(cell.getStringCellValue());
        texto1.paintAll(texto1.getGraphics());
        texto1.setText("Importando itens de configurao: " + cell.getStringCellValue());
        texto1.paintAll(texto1.getGraphics());

        i++;
        cellReference = new CellReference("A" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());
        qtdConf++;
    }

    //Capturando dados TRG
    i = 17;
    cellReference = new CellReference("A" + i);
    row = sheetConf.getRow(cellReference.getRow());
    cell = row.getCell(cellReference.getCol());
    System.out.println(cell.getStringCellValue());

    i++;
    while (cell != null) {
        cellReference = new CellReference("A" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());
        System.out.println(cell.getStringCellValue());
        texto1.paintAll(texto1.getGraphics());
        texto1.setText("Importando itens de configurao: " + cell.getStringCellValue());
        texto1.paintAll(texto1.getGraphics());

        i++;
        cellReference = new CellReference("A" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());
        qtdConf++;
    }

    //Capturando dados CADEIA
    i = 17;
    cellReference = new CellReference("A" + i);
    row = sheetConf.getRow(cellReference.getRow());
    cell = row.getCell(cellReference.getCol());
    System.out.println(cell.getStringCellValue());

    i++;
    while (cell != null) {
        cellReference = new CellReference("A" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());
        System.out.println(cell.getStringCellValue());
        texto1.paintAll(texto1.getGraphics());
        texto1.setText("Importando itens de configurao: " + cell.getStringCellValue());
        texto1.paintAll(texto1.getGraphics());

        i++;
        cellReference = new CellReference("A" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());
        qtdConf++;
    }

    //Capturando dados TP REQUISITO
    i = 32;
    cellReference = new CellReference("A" + i);
    row = sheetConf.getRow(cellReference.getRow());
    cell = row.getCell(cellReference.getCol());
    System.out.println(cell.getStringCellValue());

    i++;
    while (cell != null) {
        cellReference = new CellReference("A" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());
        System.out.println(cell.getStringCellValue());
        texto1.paintAll(texto1.getGraphics());
        texto1.setText("Importando itens de configurao: " + cell.getStringCellValue());
        texto1.paintAll(texto1.getGraphics());

        i++;
        cellReference = new CellReference("A" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());
        qtdConf++;
    }

    //Capturando dados criao/alterao
    i = 27;
    cellReference = new CellReference("A" + i);
    row = sheetConf.getRow(cellReference.getRow());
    cell = row.getCell(cellReference.getCol());
    System.out.println(cell.getStringCellValue());

    i++;
    while (cell != null) {
        cellReference = new CellReference("A" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());
        System.out.println(cell.getStringCellValue());
        texto1.paintAll(texto1.getGraphics());
        texto1.setText("Importando itens de configurao: " + cell.getStringCellValue());
        texto1.paintAll(texto1.getGraphics());

        i++;
        cellReference = new CellReference("A" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());
        qtdConf++;
    }

    //Capturando dados SISTEMA MASTER
    i = 1;
    cellReference = new CellReference("C" + i);
    row = sheetConf.getRow(cellReference.getRow());
    cell = row.getCell(cellReference.getCol());
    System.out.println(cell.getStringCellValue());

    i++;
    while (cell != null) {
        cellReference = new CellReference("C" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());
        System.out.println(cell.getStringCellValue());
        texto1.paintAll(texto1.getGraphics());
        texto1.setText("Importando itens de configurao: " + cell.getStringCellValue());
        texto1.paintAll(texto1.getGraphics());

        i++;
        cellReference = new CellReference("C" + i);
        row = sheetConf.getRow(cellReference.getRow());
        qtdConf++;

        if (row == null) {
            cell = null;

        } else {
            cell = row.getCell(cellReference.getCol(), row.RETURN_BLANK_AS_NULL);
        }

    }

    //Capturando dados FUNCIONALIDADE
    i = 1;
    cellReference = new CellReference("E" + i);
    row = sheetConf.getRow(cellReference.getRow());
    cell = row.getCell(cellReference.getCol());
    System.out.println(cell.getStringCellValue());

    i++;
    while (cell != null) {
        cellReference = new CellReference("E" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());
        System.out.println(cell.getStringCellValue());
        texto1.paintAll(texto1.getGraphics());
        texto1.setText("Importando itens de configurao: " + cell.getStringCellValue());
        texto1.paintAll(texto1.getGraphics());

        qtdConf++;
        i++;
        cellReference = new CellReference("E" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());

    }

    //Capturando dados CENARIO INTEGRADO
    i = 1;
    cellReference = new CellReference("G" + i);
    row = sheetConf.getRow(cellReference.getRow());
    cell = row.getCell(cellReference.getCol());
    System.out.println(cell.getStringCellValue());

    i++;
    while (cell != null) {
        cellReference = new CellReference("G" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());
        System.out.println(cell.getStringCellValue());
        texto1.paintAll(texto1.getGraphics());
        texto1.setText("Importando itens de configurao: " + cell.getStringCellValue());
        texto1.paintAll(texto1.getGraphics());

        i++;
        cellReference = new CellReference("G" + i);
        row = sheetConf.getRow(cellReference.getRow());
        cell = row.getCell(cellReference.getCol());
        qtdConf++;
    }

    return qtdConf;
}

From source file:com.accenture.control.ImportaStepPadrao.java

public List<StepPadrao> getStepPadraoPlanilha(String planilha)
        throws SQLException, ClassNotFoundException, FileNotFoundException, IOException {
    int linha = 1;
    List<StepPadrao> listSp = new ArrayList<StepPadrao>();

    // fazendo uma instacia do banco
    ManipulaDadosSQLite bdLite = new ManipulaDadosSQLite();
    //Setando caminho da planilha para o arquivo
    FileInputStream arquivo = new FileInputStream(new File(planilha));
    // Instnciando um workbook e passando o arquivo como parametro
    XSSFWorkbook workbook = new XSSFWorkbook(arquivo);
    //Selecionando a segunda planilha
    XSSFSheet aba = workbook.getSheetAt(1);
    //Selecionando a segunda linha (1)
    Row row = aba.getRow(linha);/*w ww.j  a  va2  s . c  om*/
    //selecionando a celula A2
    Cell celVersao = row.getCell(4);

    //Selecionando a segunda linha (1)
    row = aba.getRow(linha);
    //selecionando a celula A2(descrio)
    Cell celDesc = row.getCell(0);
    //selecionando a celula A2(Resultado esperado)
    Cell celResultado = row.getCell(1);
    //selecionando a celula A2(tipo)
    Cell celTipo = row.getCell(2);
    //selecionando a celula A2(sistema)
    Cell celSistema = row.getCell(3);

    //loop para capturar todos os steps padrao da planilha
    while (celDesc != null) {
        StepPadrao sp = new StepPadrao();
        row = aba.getRow(linha);
        celDesc = row.getCell(0);
        celResultado = row.getCell(1);
        celTipo = row.getCell(2);
        celSistema = row.getCell(3);
        celVersao = row.getCell(4);

        sp.setDescStep(celDesc.getStringCellValue());
        sp.setResultadoStep(celResultado.getStringCellValue());
        sp.setTipoStepPadrao(celTipo.getStringCellValue());
        sp.setSistema(celSistema.getStringCellValue());
        sp.setVersao(celVersao.getNumericCellValue());
        linha++;
        listSp.add(sp);
        row = aba.getRow(linha);
        celDesc = row.getCell(0);
        celResultado = row.getCell(1);
        celTipo = row.getCell(2);
        celSistema = row.getCell(3);
        celVersao = row.getCell(4);
    }

    return listSp;
}

From source file:com.accenture.control.ImportaStepPadrao.java

/**
 * Verifica se a verso que existe no banco  maior do que a verso da planilha
 *
 * @return caso a verso da planilha seja maior retorna true, caso no retorna falso
 *//*  w  w  w.ja  va 2 s. co  m*/
public boolean verificaVersao(String planilha)
        throws SQLException, ClassNotFoundException, FileNotFoundException, IOException {
    int linha = 1;
    StepPadrao sp = new StepPadrao();
    double versao = 0;

    // fazendo uma instacia do banco
    ManipulaDadosSQLite bd = new ManipulaDadosSQLite();
    //Setando caminho da planilha para o arquivo
    FileInputStream arquivo = new FileInputStream(new File(planilha));
    // Instnciando um workbook e passando o arquivo como parametro
    XSSFWorkbook workbook = new XSSFWorkbook(arquivo);
    //Selecionando a primeira planilha
    XSSFSheet aba = workbook.getSheetAt(0);
    //Selecionando a segunda linha (1)
    Row row = aba.getRow(linha);
    //selecionando a celula A2
    Cell celVersao = row.getCell(0);

    //loop para capturar a ltima verso da planilha
    while (celVersao.getNumericCellValue() != 0) {
        //           double versao = 0;

        versao = celVersao.getNumericCellValue();
        linha = linha + 1;
        row = aba.getRow(linha);
        celVersao = row.getCell(0);
    }

    if (versao <= bd.getVersaoStepPadrao()) {
        return false;
    } else {
        return true;
    }

}

From source file:com.accenture.control.ImportaStepPadrao.java

/**
 * Verifica se a verso que existe no banco  maior do que a verso da planilha
 *
 * @return caso a verso da planilha seja maior retorna true, caso no retorna falso
 *//* w ww  .  j a va2 s  .c o  m*/
public double getVersaoPlanilha(String planilha)
        throws SQLException, ClassNotFoundException, FileNotFoundException, IOException {
    int linha = 1;
    StepPadrao sp = new StepPadrao();
    double versao = 0;

    // fazendo uma instacia do banco
    ManipulaDadosSQLite bd = new ManipulaDadosSQLite();
    //Setando caminho da planilha para o arquivo
    FileInputStream arquivo = new FileInputStream(new File(planilha));
    // Instnciando um workbook e passando o arquivo como parametro
    XSSFWorkbook workbook = new XSSFWorkbook(arquivo);
    //Selecionando a primeira planilha
    XSSFSheet aba = workbook.getSheetAt(0);
    //Selecionando a segunda linha (1)
    Row row = aba.getRow(linha);
    //selecionando a celula A2
    Cell celVersao = row.getCell(0);

    //loop para capturar a ltima verso da planilha
    while (celVersao.getNumericCellValue() != 0) {
        //           double versao = 0;

        versao = celVersao.getNumericCellValue();
        linha = linha + 1;
        row = aba.getRow(linha);
        celVersao = row.getCell(0);
    }

    return versao;

}

From source file:com.accenture.ts.dao.TesteCaseTSDAO.java

public boolean newTsSheet(String pathSheet, String nameSheet, List<TesteCaseTSBean> listTestCase)
        throws FileNotFoundException, IOException {
    boolean sucess = false;
    destinationSheet = new File(pathSheet);
    destinationSheet.mkdirs();//from   w  w w  .j  a v a  2 s .co m
    destinationSheet = new File(pathSheet + "\\" + nameSheet);
    sourceStheet = new File(sheetDefault);
    copySheet(sourceStheet, destinationSheet);
    FileInputStream fileSheet = new FileInputStream(destinationSheet);

    XSSFWorkbook workbook = new XSSFWorkbook(fileSheet);
    XSSFSheet sheetTS = workbook.getSheetAt(0);

    XSSFDataFormat format = workbook.createDataFormat();
    XSSFCellStyle estilo = workbook.createCellStyle();
    //        String formatData = "aaaa-mm-dd\"T12:00:00-03:00\"";

    int linha = 1;

    Row row = sheetTS.getRow(linha);

    Cell descriptionPlan = row.getCell(0);
    Cell prj = row.getCell(1);
    Cell fase = row.getCell(2);
    Cell testPhase = row.getCell(3);
    Cell testScriptName = row.getCell(4);
    Cell testScriptDescription = row.getCell(5);
    Cell stepNo = row.getCell(6);
    Cell stepDescription = row.getCell(7);
    Cell expectedResults = row.getCell(8);
    Cell product = row.getCell(9);
    Cell dataPlanejada = row.getCell(10);

    if (listTestCase.size() > 0) {
        descriptionPlan.setCellValue(listTestCase.get(0).getTestPlan());
        prj.setCellValue(listTestCase.get(0).getSTIPRJ());
        fase.setCellValue(listTestCase.get(0).getFASE());
        testPhase.setCellValue(listTestCase.get(0).getTestPhase());
    }

    for (int i = 0; i < listTestCase.size(); i++) {

        //            estilo.setDataFormat(format.getFormat(formatData));
        //            estilo.setFillBackgroundColor(HSSFColor.GREEN.index);

        row = sheetTS.getRow(linha);

        prj = row.getCell(1);
        fase = row.getCell(2);
        testPhase = row.getCell(3);
        testScriptName = row.getCell(4);
        testScriptDescription = row.getCell(5);
        stepNo = row.getCell(6);
        stepDescription = row.getCell(7);
        expectedResults = row.getCell(8);
        product = row.getCell(9);
        dataPlanejada = row.getCell(10);

        testScriptName.setCellValue(listTestCase.get(i).getTestScriptName());
        testScriptDescription.setCellValue(listTestCase.get(i).getTestScriptDescription());
        stepNo.setCellValue(listTestCase.get(i).getSTEP_NUMERO());
        stepDescription.setCellValue(listTestCase.get(i).getStepDescription());
        expectedResults.setCellValue(listTestCase.get(i).getExpectedResults());
        product.setCellValue(listTestCase.get(i).getProduct());
        estilo = (XSSFCellStyle) dataPlanejada.getCellStyle();
        dataPlanejada.setCellValue(listTestCase.get(i).getDataPlanejada());
        dataPlanejada.setCellStyle(estilo);

        linha = linha + 2;

    }

    FileOutputStream fileOut = new FileOutputStream(destinationSheet);
    workbook.write(fileOut);
    fileOut.close();
    fileSheet.close();
    sucess = true;

    return sucess;
}