Example usage for org.apache.poi.hssf.usermodel HSSFWorkbook write

List of usage examples for org.apache.poi.hssf.usermodel HSSFWorkbook write

Introduction

In this page you can find the example usage for org.apache.poi.hssf.usermodel HSSFWorkbook write.

Prototype

private void write(POIFSFileSystem fs) throws IOException 

Source Link

Document

Writes the workbook out to a brand new, empty POIFS

Usage

From source file:co.com.controlestatidisticoshewhart.main.VentanaPrincipal.java

private void obtenerRutaGuardarArchivo() {
    try {/*from  w  w w .j a  va2s  . co m*/
        JFileChooser file = new JFileChooser();
        file.showSaveDialog(this);
        File guarda = file.getSelectedFile();

        if (guarda != null) {

            String nombreArchivo = guarda.getAbsolutePath() + Constante.XLS;

            HSSFWorkbook workbook = new HSSFWorkbook();
            HSSFSheet hojaUnoDatosGenerados = workbook.createSheet(Constante.TITULO_HOJA_DATOS);
            HSSFSheet hojaDosDatosResultados = workbook.createSheet(Constante.TITULO_HOJA_RESULTADOS);

            List<Dato> datosGenerados = DatosExcelSingleton.getInstance().getListaDatosExcel();
            Map resultadosCalculo = DatosExcelSingleton.getInstance().getResultadosDeCalculo();

            HSSFRow rowhead = hojaUnoDatosGenerados.createRow((short) 0);
            /** Encabezado hoja uno. */
            rowhead.createCell(0).setCellValue(Constante.INDICE);
            rowhead.createCell(1).setCellValue(Constante.DATO_ALEATORIO);
            rowhead.createCell(2).setCellValue(Constante.SUPERA_LIMITE_INFERIOR);
            rowhead.createCell(3).setCellValue(Constante.SUPERA_LIMITE_SUPERIOR);

            HSSFRow rowheadHojaDos = hojaDosDatosResultados.createRow((short) 0);
            /** Encabezado hoja dos. */
            rowheadHojaDos.createCell(0).setCellValue(Constante.COLUMNA_LIMITE_INFERIOR);
            rowheadHojaDos.createCell(1).setCellValue(Constante.COLUMNA_LIMITE_SUPERIOR);
            rowheadHojaDos.createCell(2).setCellValue(Constante.COLUMNA_MEDIA);
            rowheadHojaDos.createCell(3).setCellValue(Constante.COLUMNA_DATOS_FUERA_LIMITE);
            rowheadHojaDos.createCell(4).setCellValue(Constante.COLUMNA_ARL);

            /**
             * Escribir en hoja uno.
             */
            HSSFRow row = null;
            int fila = 1;
            for (int i = 0; i < datosGenerados.size(); i++) {
                row = hojaUnoDatosGenerados.createRow(fila++);
                row.createCell(0).setCellValue(datosGenerados.get(i).getSecuencial());
                row.createCell(1).setCellValue(datosGenerados.get(i).getNumero());
                row.createCell(2).setCellValue(datosGenerados.get(i).isSobrePasaLimiteInferior());
                row.createCell(3).setCellValue(datosGenerados.get(i).isSobrePasaLimiteSuperior());
            }

            /** 
             * Escribir en hoja dos.
             */
            HSSFRow filaResultados = null;
            filaResultados = hojaDosDatosResultados.createRow(1);
            filaResultados.createCell(0)
                    .setCellValue(resultadosCalculo.get(Constante.LIMITE_CONTROL_INFERIOR).toString());
            filaResultados.createCell(1)
                    .setCellValue(resultadosCalculo.get(Constante.LIMITE_CONTROL_SUPERIOR).toString());
            filaResultados.createCell(2)
                    .setCellValue(resultadosCalculo.get(Constante.MEDIA_DATOS_EXTREMOS).toString());
            filaResultados.createCell(3)
                    .setCellValue(resultadosCalculo.get(Constante.CANTIDAD_DATOS_EXTREMOS).toString());
            filaResultados.createCell(4)
                    .setCellValue(resultadosCalculo.get(Constante.AVERAGE_RUN_LENGTH).toString());

            /**
             * Ajustar columnas hoja uno.
             */
            hojaUnoDatosGenerados.autoSizeColumn(0);
            hojaUnoDatosGenerados.autoSizeColumn(1);
            hojaUnoDatosGenerados.autoSizeColumn(2);
            hojaUnoDatosGenerados.autoSizeColumn(3);

            /**
             * Ajustar columnas hoja dos.
             */
            hojaDosDatosResultados.autoSizeColumn(0);
            hojaDosDatosResultados.autoSizeColumn(1);
            hojaDosDatosResultados.autoSizeColumn(2);
            hojaDosDatosResultados.autoSizeColumn(3);
            hojaDosDatosResultados.autoSizeColumn(4);

            try (FileOutputStream fileOut = new FileOutputStream(nombreArchivo)) {
                workbook.write(fileOut);
            } catch (Exception e) {
                throw new Exception("Error al escribir el archivo. Intente de nuevo.");
            }
            mensaje(Constante.ARCHIVO_EXCEL_CON_RESULTADOS_GENERADO);
            JOptionPane.showMessageDialog(null, "El archivo se ha guardado Exitosamente.", "Informacin",
                    JOptionPane.INFORMATION_MESSAGE);
        } else {
            mensaje("Debe seleccionar una ruta valida e ingresar el nombre del archivo.");
            JOptionPane.showMessageDialog(null,
                    "Debe seleccionar una ruta valida e ingresar el nombre del archivo.", "Advertencia",
                    JOptionPane.WARNING_MESSAGE);
        }
    } catch (Exception ex) {
        mensaje("Error al generar el archivo.Intentelo de nuevo.");
        JOptionPane.showMessageDialog(null, "Su archivo no se ha guardado", "Advertencia",
                JOptionPane.WARNING_MESSAGE);
    }
}

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

License:Open Source License

public void write(AlgoBottlenecksData report, File file) {
    try {//from  ww w . j a  v  a  2s  . c o  m
        HSSFWorkbook workbook = new HSSFWorkbook();

        titleFont = workbook.createFont();
        titleFont.setFontName("Arial");
        titleFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);

        cellStyle = workbook.createCellStyle();
        cellStyle.setDataFormat(workbook.getCreationHelper().createDataFormat().getFormat("m/d/yy h:mm"));

        HotspotsDataAnalyser analyzer = new HotspotsDataAnalyser(report);
        writeSummary(workbook, report.getNetwork(), analyzer);
        writeActorClassesTable(workbook, analyzer);
        writeActorsTable(workbook, analyzer);
        writeActionActorClassTable(workbook, analyzer);
        writeActionActorTable(workbook, analyzer);

        // check if there are also impact analysis data
        ImpactData impactData = report.getImpactData();
        if (impactData != null) {
            writeImpactAnalysis(workbook, impactData);
        }

        OutputStream out = new FileOutputStream(file);
        out = new BufferedOutputStream(out);
        workbook.write(out);
        out.close();
    } catch (Exception e) {
        throw new TurnusRuntimeException("Error writing the excel file " + file, e.getCause());
    }

}

From source file:co.turnus.analysis.data.buffers.io.XlsBufferMinimizationDataWriter.java

License:Open Source License

public void write(BufferMinimizationData report, File file) {
    try {// w  ww .jav  a  2s  .  c  om
        HSSFWorkbook workbook = new HSSFWorkbook();

        titleFont = workbook.createFont();
        titleFont.setFontName("Arial");
        titleFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);

        int solutionId = 1;
        for (BuffersData data : report.getBuffersData()) {
            writeData(workbook, data, report.getNetwork(), report.getAlgorithm(), solutionId++);
        }

        OutputStream out = new FileOutputStream(file);
        out = new BufferedOutputStream(out);
        workbook.write(out);
        out.close();
    } catch (Exception e) {
        throw new TurnusRuntimeException("Error writing the excel file " + file, e.getCause());
    }
}

From source file:co.turnus.analysis.data.partitioning.io.XlsPartitioningDataWriter.java

License:Open Source License

public void write(PartitioningData report, File file) {
    try {/*from w  w  w.  j a  va2s.co m*/
        HSSFWorkbook workbook = new HSSFWorkbook();

        titleFont = workbook.createFont();
        titleFont.setFontName("Arial");
        titleFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);

        int solutionId = 1;
        for (PartitionsData data : report.getPartitionsData()) {
            writeData(workbook, data, report.getNetwork(), report.getAlgorithm(), solutionId++);
        }

        OutputStream out = new FileOutputStream(file);
        out = new BufferedOutputStream(out);
        workbook.write(out);
        out.close();
    } catch (Exception e) {
        throw new TurnusRuntimeException("Error writing the excel file " + file, e.getCause());
    }

}

From source file:co.turnus.analysis.data.pipelining.io.XlsSimplePipeliningDataWriter.java

License:Open Source License

public void write(SimplePipelingData report, File file) {
    try {//from   w w w.j  a v  a2 s  .c  o m

        HSSFWorkbook workbook = new HSSFWorkbook();

        titleFont = workbook.createFont();
        titleFont.setFontName("Arial");
        titleFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);

        cellStyle = workbook.createCellStyle();
        cellStyle.setDataFormat(workbook.getCreationHelper().createDataFormat().getFormat("m/d/yy h:mm"));

        HSSFSheet sheet = workbook.createSheet("Pipelinable <Actor, Action>");
        // Action Actor Class Results
        Cell cell = sheet.createRow(0).createCell(0);
        HSSFRichTextString title = new HSSFRichTextString("Action and Actor Pipelining Results");
        title.applyFont(titleFont);
        cell.setCellValue(title);

        Row row = sheet.createRow(1);
        sheet.addMergedRegion(new CellRangeAddress(1, 3, 0, 0));
        row.createCell(0).setCellValue("Actor");
        sheet.addMergedRegion(new CellRangeAddress(1, 3, 1, 1));
        row.createCell(1).setCellValue("Action");
        sheet.addMergedRegion(new CellRangeAddress(1, 3, 2, 2));
        row.createCell(2).setCellValue("pipelinable");
        sheet.addMergedRegion(new CellRangeAddress(1, 1, 3, 10));
        row.createCell(3).setCellValue("Consecutive Executions");
        sheet.addMergedRegion(new CellRangeAddress(1, 3, 11, 11));
        row.createCell(11).setCellValue("Splittable Actions");

        row = sheet.createRow(2);
        sheet.addMergedRegion(new CellRangeAddress(2, 2, 3, 6));
        row.createCell(3).setCellValue("Pipelinable");
        sheet.addMergedRegion(new CellRangeAddress(2, 2, 7, 10));
        row.createCell(7).setCellValue("Unconstrained");
        row = sheet.createRow(3);
        row.createCell(3).setCellValue("min");
        row.createCell(4).setCellValue("mean");
        row.createCell(5).setCellValue("max");
        row.createCell(6).setCellValue("var");
        row.createCell(7).setCellValue("min");
        row.createCell(8).setCellValue("mean");
        row.createCell(9).setCellValue("max");
        row.createCell(10).setCellValue("var");

        int rowId = 4;
        Map<Actor, Map<Action, SimpleActionPipeliningData>> table = report.asTable().rowMap();
        for (Map<Action, SimpleActionPipeliningData> ac : table.values()) {
            for (SimpleActionPipeliningData data : ac.values()) {
                row = sheet.createRow(rowId);
                row.createCell(0).setCellValue(data.getActor().getId());
                row.createCell(1).setCellValue(data.getAction().getId());

                row.createCell(2).setCellValue(data.isPipelinable());

                StatisticalData stat = data.getPipelinableRepetitions();
                if (stat.getSamples() > 0) {
                    row.createCell(3).setCellValue(stat.getMin());
                    row.createCell(4).setCellValue(stat.getMean());
                    row.createCell(5).setCellValue(stat.getMax());
                    row.createCell(6).setCellValue(stat.getVariance());
                } else {
                    row.createCell(3).setCellValue("-");
                    row.createCell(4).setCellValue("-");
                    row.createCell(5).setCellValue("-");
                    row.createCell(6).setCellValue("-");
                }

                stat = data.getUnconstrainedRepetitions();
                if (stat.getSamples() > 0) {
                    row.createCell(7).setCellValue(stat.getMin());
                    row.createCell(8).setCellValue(stat.getMean());
                    row.createCell(9).setCellValue(stat.getMax());
                    row.createCell(10).setCellValue(stat.getVariance());
                } else {
                    row.createCell(7).setCellValue("-");
                    row.createCell(8).setCellValue("-");
                    row.createCell(9).setCellValue("-");
                    row.createCell(10).setCellValue("-");
                }

                StringBuffer b = new StringBuffer();
                for (Action action : data.getSplittableActions()) {
                    b.append(action.getId()).append(" ");
                }
                row.createCell(11).setCellValue(b.toString());

                rowId++;
            }
        }

        OutputStream out = new FileOutputStream(file);
        out = new BufferedOutputStream(out);
        workbook.write(out);
        out.close();

    } catch (Exception e) {
        throw new TurnusRuntimeException("Error writing the excel file " + file, e.getCause());
    }
}

From source file:co.turnus.profiling.io.XlsHalsteadAnalysisWriter.java

License:Open Source License

public void write(SourceCodeData report, File file) {
    try {//from w  w w  .j a  v  a 2 s  .c o  m
        HSSFWorkbook workbook = new HSSFWorkbook();

        titleFont = workbook.createFont();
        titleFont.setFontName("Arial");
        titleFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);

        cellStyle = workbook.createCellStyle();
        cellStyle.setDataFormat(workbook.getCreationHelper().createDataFormat().getFormat("m/d/yy h:mm"));

        writeSummary(workbook, report.getNetwork(), report);
        writeActorClassesTable(workbook, report);

        OutputStream out = new FileOutputStream(file);
        out = new BufferedOutputStream(out);
        workbook.write(out);
        out.close();
    } catch (Exception e) {
        throw new TurnusRuntimeException("Error writing the excel file " + file, e.getCause());
    }

}

From source file:co.turnus.profiling.io.XlsProfilingDataWriter.java

License:Open Source License

public void write(File file, ProfilingData data) {
    try {/*from w  ww.j a v  a  2  s. c o  m*/
        HSSFWorkbook workbook = new HSSFWorkbook();

        titleFont = workbook.createFont();
        titleFont.setFontName("Arial");
        titleFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);

        cellStyle = workbook.createCellStyle();
        cellStyle.setDataFormat(workbook.getCreationHelper().createDataFormat().getFormat("m/d/yy h:mm"));

        // writeSummary(workbook, data.getNetwork(), data);
        writeFifosData(workbook, data);

        OutputStream out = new FileOutputStream(file);
        out = new BufferedOutputStream(out);
        workbook.write(out);
        out.close();
    } catch (Exception e) {
        throw new TurnusRuntimeException("Error writing the excel file " + file, e.getCause());
    }
}

From source file:com.aan.girsang.client.ui.master.barang.BarangPanel.java

private void exportExcel(List<Barang> dataList) throws IOException {
    if (dataList != null && !dataList.isEmpty()) {
        HSSFWorkbook workBook = new HSSFWorkbook();
        HSSFSheet sheet = workBook.createSheet();
        HSSFSheet worksheet = workBook.createSheet("Sheet 0");
        // Nama Field
        Row judul = sheet.createRow((short) 0);
        Cell cell = judul.createCell((short) 0);
        cell.setCellValue("This is a test of merging");
        HSSFRow headingRow = sheet.createRow((short) 2);
        headingRow.createCell((short) 0).setCellValue("ID");
        headingRow.createCell((short) 1).setCellValue("BARCODE 1");
        headingRow.createCell((short) 2).setCellValue("BARCODE 2");
        headingRow.createCell((short) 3).setCellValue("NAMA BARANG");
        headingRow.createCell((short) 4).setCellValue("GOLONGAN");
        headingRow.createCell((short) 5).setCellValue("SAT. JUAL");
        headingRow.createCell((short) 6).setCellValue("ST. TOKO");
        headingRow.createCell((short) 7).setCellValue("ST. GUDANG");
        headingRow.createCell((short) 8).setCellValue("SAT. BELI");
        headingRow.createCell((short) 9).setCellValue("ISI PEM.");
        headingRow.createCell((short) 10).setCellValue("HRG PEM.");
        headingRow.createCell((short) 11).setCellValue("HRG NORMAL");
        headingRow.createCell((short) 12).setCellValue("HRG MEMBER");
        headingRow.createCell((short) 13).setCellValue("JUAL");
        int panjang = headingRow.getLastCellNum() - 1;
        short rowNo = 3;

        sheet.addMergedRegion(new CellRangeAddress(0, //first row (0-based)
                0, //last row  (0-based)
                0, //first column (0-based)
                panjang //last column  (0-based)
        ));//from  w w  w .j  a  v a2  s .  c  o m
        CellStyle styleData = workBook.createCellStyle();
        styleData.setBorderBottom(CellStyle.BORDER_THIN);
        styleData.setBorderRight(CellStyle.BORDER_THIN);
        styleData.setBorderLeft(CellStyle.BORDER_THIN);
        for (Barang b : dataList) {
            HSSFRow row = sheet.createRow(rowNo);
            String jual;
            if (b.getJual() == true) {
                jual = "Jual";
            } else {
                jual = "Tidak";
            }
            row.createCell((short) 0).setCellValue(b.getPlu());
            row.createCell((short) 1).setCellValue(b.getBarcode1());
            row.createCell((short) 2).setCellValue(b.getBarcode2());
            row.createCell((short) 3).setCellValue(b.getNamaBarang());
            row.createCell((short) 4).setCellValue(b.getGolonganBarang().getGolonganBarang());
            row.createCell((short) 5).setCellValue(b.getSatuan());
            row.createCell((short) 6).setCellValue(b.getStokToko());
            row.createCell((short) 7).setCellValue(b.getStokGudang());
            row.createCell((short) 8).setCellValue(b.getSatuanPembelian());
            row.createCell((short) 9).setCellValue(b.getIsiPembelian());
            row.createCell((short) 10).setCellValue(TextComponentUtils.formatNumber(b.getHargaBeli()));
            row.createCell((short) 11).setCellValue(TextComponentUtils.formatNumber(b.getHargaNormal()));
            row.createCell((short) 12).setCellValue(TextComponentUtils.formatNumber(b.getHargaMember()));
            row.createCell((short) 13).setCellValue(jual);
            for (int i = 0; i <= 13; i++) {
                row.getCell((short) i).setCellStyle(styleData);
            }
            rowNo++;
        }
        for (int i = 0; i <= 13; i++) {
            sheet.autoSizeColumn(i);
        }
        Font font = workBook.createFont();
        font.setBoldweight(Font.BOLDWEIGHT_BOLD);
        //style judul
        CellStyle styleTitle = workBook.createCellStyle();
        styleTitle.setAlignment(CellStyle.ALIGN_CENTER_SELECTION);
        styleTitle.setFont(font);
        judul.getCell(0).setCellStyle(styleTitle);

        //judul field
        CellStyle styleHeading = workBook.createCellStyle();
        styleHeading.setFont(font);
        styleHeading.setAlignment(CellStyle.ALIGN_CENTER_SELECTION);
        styleHeading.setBorderBottom(CellStyle.BORDER_THIN);
        styleHeading.setBorderTop(CellStyle.BORDER_THIN);
        styleHeading.setBorderRight(CellStyle.BORDER_THIN);
        styleHeading.setBorderLeft(CellStyle.BORDER_THIN);
        for (int i = 0; i < headingRow.getLastCellNum(); i++) {//For each cell in the row 
            headingRow.getCell(i).setCellStyle(styleHeading);//Set the style
        }
        String file = "D:/Student_detais.xls";
        try {
            try (FileOutputStream fos = new FileOutputStream(file)) {
                workBook.write(fos);
            }
            JOptionPane.showMessageDialog(null, "Sukses");
        } catch (FileNotFoundException e) {
            System.out.println("Invalid directory or file not found");
        } catch (IOException e) {
            System.out.println("Error occurred while writting excel file to directory");
        }
    }
}

From source file:com.abacus.reports.ExcelBuilder.java

@Override
protected void buildExcelDocument(Map<String, Object> map, HSSFWorkbook workbook, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    // get data model which is passed by the Spring container
    List headerlist = (List) map.get("header");
    List<Object[]> data = (List) map.get("data");
    String reportname = String.valueOf(map.get("report_name"));

    // create a new Excel sheet
    HSSFSheet sheet = workbook.createSheet(reportname);
    response.setContentType("application/vnd.ms-excel");
    response.setHeader("Content-disposition", "attachment; filename=" + reportname + ".xls");
    OutputStream outStream = response.getOutputStream();
    sheet.setDefaultColumnWidth(30);//from w ww .ja v  a 2s . co m

    // create style for header cells
    CellStyle style = workbook.createCellStyle();
    HSSFFont font = workbook.createFont();
    HSSFPalette palette = workbook.getCustomPalette();
    HSSFColor color = palette.findSimilarColor(152, 35, 17);
    short paindex = color.getIndex();
    font.setFontName("Trebuchet MS");
    style.setFillForegroundColor(paindex);
    style.setFillPattern(CellStyle.SOLID_FOREGROUND);
    font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
    font.setColor(HSSFColor.WHITE.index);
    style.setFont(font);

    // create header row
    HSSFRow header = sheet.createRow(0);
    int row = 0;
    for (Object headerlist1 : headerlist) {

        header.createCell(row).setCellValue(String.valueOf(headerlist1));
        header.getCell(row).setCellStyle(style);
        row++;
    }

    CellStyle style2 = workbook.createCellStyle();
    HSSFFont font2 = workbook.createFont();
    font2.setFontName("Trebuchet MS");
    style2.setFont(font2);

    System.out.println("data.size(): " + data.size());
    int rownum = 1;
    // create data rows         
    for (int rowCount = 0; rowCount < data.size(); rowCount++) {
        HSSFRow aRow = sheet.createRow(rownum);
        Object[] value = data.get(rowCount);
        int col = 0;
        for (Object value1 : value) {
            HSSFCell cell = aRow.createCell(col++);
            cell.setCellStyle(style2);
            if (value1 instanceof java.lang.String)
                cell.setCellValue(String.valueOf(value1));
            if (value1 instanceof java.lang.Integer)
                cell.setCellValue(Integer.parseInt(String.valueOf(value1)));
            if (value1 instanceof java.lang.Boolean)
                cell.setCellValue(Integer.parseInt(String.valueOf(value1)));
            if (value1 instanceof java.lang.Double)
                cell.setCellValue(Double.parseDouble(String.valueOf(value1)));
            if (value1 instanceof java.lang.Float)
                cell.setCellValue(Float.parseFloat(String.valueOf(value1)));
        }
        rownum++;
    }
    workbook.write(outStream);
    outStream.close();
}

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

public void geraNovaPlanilhaTS(String dir, List<TesteCaseTSBean> listTS)
        throws FileNotFoundException, IOException {

    FileInputStream arquivo = new FileInputStream(new File(dir));
    HSSFWorkbook workbook = new HSSFWorkbook(arquivo);
    HSSFSheet sheetTS = workbook.getSheetAt(0);

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

    int linha = 1;

    Row row = sheetTS.getRow(linha);/*  w w  w.  j a va2 s .c om*/

    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);

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

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

        row = sheetTS.getRow(linha);

        descriptionPlan = row.getCell(0);
        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);

        descriptionPlan.setCellValue(listTS.get(i).getTestPlan());
        prj.setCellValue(listTS.get(i).getSTIPRJ());
        fase.setCellValue(listTS.get(i).getFASE());
        testPhase.setCellValue(listTS.get(i).getTestPhase());
        testScriptName.setCellValue(listTS.get(i).getTestScriptName());
        testScriptDescription.setCellValue(listTS.get(i).getTestScriptDescription());
        stepNo.setCellValue(listTS.get(i).getSTEP_NUMERO());
        stepDescription.setCellValue(listTS.get(i).getStepDescription());
        expectedResults.setCellValue(listTS.get(i).getExpectedResults());
        product.setCellValue(listTS.get(i).getProduct());
        dataPlanejada.setCellValue(listTS.get(i).getDataPlanejada());

        dataPlanejada.setCellStyle(estilo);

        linha = linha + 2;

    }

    FileOutputStream fileOut = new FileOutputStream(new File(dir));
    workbook.write(fileOut);
    fileOut.close();
    arquivo.close();

}