Example usage for org.apache.poi.ss.usermodel Workbook write

List of usage examples for org.apache.poi.ss.usermodel Workbook write

Introduction

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

Prototype

void write(OutputStream stream) throws IOException;

Source Link

Document

Write out this workbook to an Outputstream.

Usage

From source file:Creator.MainFrame.java

private void _MenuItem_SaveAllActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event__MenuItem_SaveAllActionPerformed

    _FileChooser.setDialogTitle("Save everything into a folder");
    _FileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    _FileChooser.setDialogType(JFileChooser.SAVE_DIALOG);
    _FileChooser.setApproveButtonText("Save Here");
    _FileChooser.setApproveButtonToolTipText("Save");

    int returnVal = _FileChooser.showSaveDialog(this);
    if (returnVal == JFileChooser.APPROVE_OPTION) {
        String filePathORIGINAL = _FileChooser.getSelectedFile().toString();
        String fn = filePathORIGINAL + "\\" + this.store.getStoreName() + ".xml";

        // What to do with the file, e.g. display it in a TextArea
        if (xmlParser != null) {
            if (xmlParser.writeOut(this.store, fn)) {
                controlPanel.writeToLog("Store " + this.store.getStoreName() + " saved");
            } else {
                controlPanel.writeToLog("Store " + this.store.getStoreName() + " had a problem saving");
            }//  w  ww .  ja v a2s  . co  m
        } else {
            System.out.println("Problem with the XMLParser");
        }

        // -------------------- Save all displays --------------------------
        String filePath = filePathORIGINAL + "\\Displays\\";

        if (!new File(filePath).mkdir()) {
            filePath = filePath.replace("Displays\\", "");
        }
        //System.out.println("FP: " + filePath);
        String[] fileNames = controlPanel.getFileNames(filePath, displayFrame.bg.getSize());
        int numDisplays = displayFrame.getTabCount();
        BufferedImage bi;

        int numRacks = store.cs.getNumRacks();
        for (int i = 0; i < numDisplays; i++) {
            //System.out.println(i + ": " + fileNames[i]);
            try {
                if (i == 0) {
                    bi = ScreenImage.createImage(displayFrame.bg);
                } else if (i > 0 && i <= numRacks) {
                    bi = ScreenImage.createImage(displayFrame.rackTabs.get(i - 1));
                    /*} else if (i > numRacks && i <= (numRacks * 2)) {
                        bi = ScreenImage.createImage(displayFrame.loadTabs.get(i - (numRacks + 1)));
                    */} else if (i == (numDisplays - 3)) {
                    bi = ScreenImage.createImage(displayFrame.bgf);
                } else if (i == (numDisplays - 2)) {
                    bi = ScreenImage.createImage(displayFrame.bge);
                } else if (i == (numDisplays - 1)) {
                    bi = ScreenImage.createImage(displayFrame.bgg);
                } else {
                    System.out.println("Screen Print else on i = " + i);
                    bi = ScreenImage.createImage(displayFrame.bg);
                }

                ScreenImage.writeImage(bi, fileNames[i]);
                //ScreenImage.createImage();

            } catch (IOException e) {
                controlPanel.writeToLog("Error writing image file" + e.getMessage());
            }
        }

        // -------------------------- Save XLSX --------------------
        File file = new File(filePathORIGINAL + "\\" + this.store.getStoreName() + "-IOVariables.xlsx");
        //System.out.println("File: " + file.getAbsolutePath());
        String excelPath = file.getAbsolutePath();

        try {
            Workbook wb = new XSSFWorkbook();
            FileOutputStream fileOut = new FileOutputStream(excelPath);

            List<String[]> list = store.formatStrings();
            int rowNum = 0;
            Sheet sheet = wb.createSheet("Var Names");

            for (String[] r : list) {
                // Create a row and put some cells in it. Rows are 0 based.
                Row row = sheet.createRow(rowNum);
                // Create a cell and put a value in it.
                for (int i = 0; i < r.length; i++) {
                    Cell cell = row.createCell(i);

                    // If the string is a number, write it as a number
                    if (r[i].equals("")) {
                        // Empty field, do nothing

                    } else if (isStringNumeric(r[i])) {
                        cell.setCellValue(Double.parseDouble(r[i].replace("\"", "")));
                    } else {
                        cell.setCellValue(r[i]);
                    }

                }

                rowNum++;

            }

            wb.write(fileOut);
            fileOut.close();
        } catch (NumberFormatException | IOException e) {
            controlPanel.writeToLog("Error with creating excel file " + e.getMessage());
        }

    } else {
        System.out.println("File access cancelled by user.");
    }
}

From source file:Creator.MainFrame.java

public void returnIoItems(List<String[]> list) {

    ioFrame.dispose();/*from w  ww . j av  a 2s  .  c  o m*/

    _FileChooser.setDialogTitle("Save Specific IO Imports As Excel File");
    _FileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
    _FileChooser.setFileFilter(new FileNameExtensionFilter("Excel workbook (.xlsx)", new String[] { "xlsx" }));
    _FileChooser.setDialogType(JFileChooser.SAVE_DIALOG);
    _FileChooser.setApproveButtonText("Save Excel file");
    _FileChooser.setApproveButtonToolTipText("Save");

    int returnVal = _FileChooser.showSaveDialog(this);
    if (returnVal == JFileChooser.APPROVE_OPTION) {

        File file = _FileChooser.getSelectedFile();
        //System.out.println("File: " + file.getAbsolutePath());
        String filePath = file.getAbsolutePath();
        if (!filePath.endsWith(".xlsx")) {
            filePath += ".xlsx";
        }

        try {
            Workbook wb = new XSSFWorkbook();
            FileOutputStream fileOut = new FileOutputStream(filePath);

            int rowNum = 0;
            Sheet sheet = wb.createSheet("Var Names");

            for (String[] r : list) {
                // Create a row and put some cells in it. Rows are 0 based.
                Row row = sheet.createRow(rowNum);
                // Create a cell and put a value in it.
                for (int i = 0; i < r.length; i++) {
                    Cell cell = row.createCell(i);

                    // If the string is a number, write it as a number
                    if (r[i].equals("")) {
                        // Empty field, do nothing

                    } else if (isStringNumeric(r[i])) {
                        cell.setCellValue(Double.parseDouble(r[i].replace("\"", "")));
                    } else {
                        cell.setCellValue(r[i]);
                    }

                }

                rowNum++;

            }

            wb.write(fileOut);
            fileOut.close();
        } catch (Exception e) {
            controlPanel.writeToLog("Error with creating excel file " + e.getMessage());
        }

    } else {
        System.out.println("File access cancelled by user.");
    }
}

From source file:cs.handmail.processtable.ExportExcel.java

public void export() {
    try {/*  w  w  w  . j a va  2s  .c om*/
        new WorkbookFactory();
        Workbook wb = new XSSFWorkbook(); //Excell workbook
        Sheet sheet = wb.createSheet(); //WorkSheet
        Row row = sheet.createRow(2); //Row created at line 3
        TableModel model = _tableExport.getModel();
        String temp;

        Row headerRow = sheet.createRow(0); //Create row at line 0
        for (int headings = 0; headings < model.getColumnCount(); headings++) {
            headerRow.createCell(headings).setCellValue(model.getColumnName(headings));//Write column name
        }

        for (int rows = 0; rows < model.getRowCount(); rows++) { //For each table row
            for (int cols = 0; cols < _tableExport.getColumnCount(); cols++) { //For each table column
                if (model.getValueAt(rows, cols) != null)
                    temp = model.getValueAt(rows, cols).toString();
                else
                    temp = "";
                row.createCell(cols).setCellValue(temp);
            }

            //Set the row to the next one in the sequence
            row = sheet.createRow((rows + 3));
        }
        wb.write(new FileOutputStream(_pathFolder + "/" + _nameFile));//Save the file    
        JOptionPane.showMessageDialog(null, "Save file Success");
    } catch (IOException ex) {
        Logger.getLogger(ExportExcel.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:csns.web.controller.SectionRosterController.java

License:Open Source License

@RequestMapping("/section/roster/export")
public String export(@RequestParam Long id, HttpServletResponse response) throws IOException {
    Section section = sectionDao.getSection(id);
    GradeSheet gradeSheet = new GradeSheet(section);

    response.setContentType(contentTypes.getProperty("xlsx"));
    response.setHeader("Content-Disposition", "attachment; filename=" + section.getCourse().getCode() + "-"
            + section.getQuarter().getShortString() + ".xlsx");

    Workbook wb = new XSSFWorkbook();
    Sheet sheet = wb.createSheet("Grades");

    int n = section.getAssignments().size();
    Row row = sheet.createRow(0);//from   w  w  w .j  ava  2 s. c  o  m
    row.createCell(0).setCellValue("Name");
    for (int i = 0; i < n; ++i)
        row.createCell(i + 1).setCellValue(section.getAssignments().get(i).getAlias());
    row.createCell(n + 1).setCellValue("Grade");

    int rowIndex = 1;
    Map<Enrollment, String[]> studentGrades = gradeSheet.getStudentGrades();
    for (Enrollment enrollment : studentGrades.keySet()) {
        row = sheet.createRow(rowIndex++);
        row.createCell(0).setCellValue(
                enrollment.getStudent().getLastName() + ", " + enrollment.getStudent().getFirstName());
        for (int i = 0; i < n; ++i) {
            Cell cell = row.createCell(i + 1);
            String grade = studentGrades.get(enrollment)[i];
            if (StringUtils.hasText(grade) && grade.matches("-?\\d+(\\.\\d+)?"))
                cell.setCellValue(Double.parseDouble(grade));
            else
                cell.setCellValue(grade);
        }
        if (enrollment.getGrade() != null)
            row.createCell(n + 1).setCellValue(enrollment.getGrade().getSymbol());
    }

    wb.write(response.getOutputStream());

    logger.info(SecurityUtils.getUser().getUsername() + " exported the roster of section " + id);

    return null;
}

From source file:csns.web.controller.SurveyController.java

License:Open Source License

@RequestMapping(value = "/department/{dept}/survey/results", params = "export=excel")
public String exportExcel(@RequestParam Long id, HttpServletResponse response) throws IOException {
    Survey survey = surveyDao.getSurvey(id);
    Workbook wb = new XSSFWorkbook();

    for (int i = 0; i < survey.getQuestionSheet().getNumOfSections(); ++i)
        exportExcel(survey, i, wb);/*from  www  . ja va 2s  .c  o m*/

    response.setContentType(contentTypes.getProperty("xlsx"));
    response.setHeader("Content-Disposition",
            "attachment; filename=" + survey.getName().replaceAll(" ", "_") + "_Results.xlsx");

    wb.write(response.getOutputStream());

    logger.info(SecurityUtils.getUser().getUsername() + " exported the results of survey " + survey.getId());

    return null;
}

From source file:csvsimulator.model.ModelSuonata.java

public void saveOnExcel(int numero_colonne, final Window w) {
    FileChooser fileChooser = new FileChooser();
    FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter("Excel (*.xlsx)", "*.xlsx");
    fileChooser.getExtensionFilters().add(extFilter);

    File file = fileChooser.showSaveDialog(w);

    if (file != null) {

        Workbook wb = new XSSFWorkbook();
        Sheet sheet = wb.createSheet("Spartito_Suonata");
        int rowIndex = 0;
        int columnIndex = 0;
        Cell cell;//from ww w  . j  av  a2 s .  c  om
        Row row = sheet.createRow(rowIndex);
        for (ModelBattuta modelBattuta : this.getListaBattute()) {
            cell = row.createCell(columnIndex);
            cell.setCellValue(modelBattuta.getNomeBattuta(this.concerto));

            columnIndex++;
            if (columnIndex >= numero_colonne) {
                rowIndex++;
                columnIndex = 0;
                row = sheet.createRow(rowIndex);
            }
        }

        // Write the output to a file
        try {
            FileOutputStream out = new FileOutputStream(file);
            wb.write(out);
            out.close();
        } catch (Exception e) {
        }

    }
}

From source file:Cuentas.editaCuentas.java

private void bt_actualiza2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bt_actualiza2ActionPerformed
    // TODO add your handling code here:
    javax.swing.JFileChooser jF1 = new javax.swing.JFileChooser();
    jF1.setFileFilter(new ExtensionFileFilter("Excel document (*.xls)", new String[] { "xls" }));
    String ruta = null;/* w w w .  j av a 2 s  . c  o  m*/
    if (jF1.showSaveDialog(null) == jF1.APPROVE_OPTION) {
        ruta = jF1.getSelectedFile().getAbsolutePath();
        if (ruta != null) {
            File archivoXLS = new File(ruta + ".xls");
            try {
                if (archivoXLS.exists())
                    archivoXLS.delete();
                archivoXLS.createNewFile();
                Workbook libro = new HSSFWorkbook();
                FileOutputStream archivo = new FileOutputStream(archivoXLS);
                Sheet hoja = libro.createSheet("Clientes");
                for (int ren = 0; ren < (t_datos.getRowCount() + 1); ren++) {
                    Row fila = hoja.createRow(ren);
                    for (int col = 0; col < t_datos.getColumnCount(); col++) {
                        Cell celda = fila.createCell(col);
                        if (ren == 0) {
                            celda.setCellValue(columnas[col]);
                        } else {
                            if (t_datos.getValueAt(ren - 1, col) == null)
                                celda.setCellValue("");
                            else {
                                if (t_datos.getValueAt(ren - 1, col).toString()
                                        .compareToIgnoreCase("false") == 0)
                                    celda.setCellValue("");
                                else {
                                    if (t_datos.getValueAt(ren - 1, col).toString()
                                            .compareToIgnoreCase("true") == 0)
                                        celda.setCellValue("x");
                                    else
                                        celda.setCellValue(t_datos.getValueAt(ren - 1, col).toString());
                                }
                            }
                        }
                    }
                }
                libro.write(archivo);
                archivo.close();
                Desktop.getDesktop().open(archivoXLS);
            } catch (Exception e) {
                System.out.println(e);
                JOptionPane.showMessageDialog(this, "No se pudo realizar el reporte");
            }
        }
    }
}

From source file:das.pf.io.IOExcel.java

License:Open Source License

public boolean processFile(Path input, boolean openFile) {
    boolean result = false;
    int endRow = 0;

    try {//from   w w  w . j a v a2s  .co  m
        updateMessages(String.format("Inicializando el documento: %s", input.toString()));
        Path copy = createCopy(input);

        if (copy != null && Files.exists(copy, LinkOption.NOFOLLOW_LINKS)) {
            Workbook workbook = WorkbookFactory.create(copy.toFile());
            Sheet sheet = workbook.getSheetAt(0);
            Sheet newSheet = workbook.createSheet("Procesado");

            workbook.setSheetName(0, "Crudo");

            endRow = getLasRow(sheet);

            // seccion para la creacion de los encabezados
            updateMessages("Creando la cabecera de los datos");
            createHeaderData(newSheet, getCellStyleHeaderData(workbook));

            // seccion para los values USD
            updateMessages(
                    String.format("Creando la cabecera para los: 'values USD' %s", TypeUnits.MTH.name()));
            createHeaderValues(newSheet, sheet, getCellStyleValues(workbook, TypeValues.VALUES, TypeUnits.MTH),
                    11, 35, 14);
            updateMessages(
                    String.format("Creando la cabecera para los: 'values USD' %s", TypeUnits.QRT.name()));
            createHeaderValues(newSheet, sheet, getCellStyleValues(workbook, TypeValues.VALUES, TypeUnits.QRT),
                    35, 49, 38);
            updateMessages(
                    String.format("Creando la cabecera para los: 'values USD' %s", TypeUnits.YTD.name()));
            createHeaderValues(newSheet, sheet, getCellStyleValues(workbook, TypeValues.VALUES, TypeUnits.YTD),
                    49, 54, 52);
            updateMessages(
                    String.format("Creando la cabecera para los: 'values USD' %s", TypeUnits.MAT.name()));
            createHeaderValues(newSheet, sheet, getCellStyleValues(workbook, TypeValues.VALUES, TypeUnits.MAT),
                    54, 59, 57);

            // seccion para los values units
            updateMessages(
                    String.format("Creando la cabecera para los: 'values Units' %s", TypeUnits.MTH.name()));
            createHeaderValues(newSheet, sheet, getCellStyleValues(workbook, TypeValues.UNITS, TypeUnits.MTH),
                    59, 83, 63);
            updateMessages(
                    String.format("Creando la cabecera para los: 'values Units' %s", TypeUnits.QRT.name()));
            createHeaderValues(newSheet, sheet, getCellStyleValues(workbook, TypeValues.UNITS, TypeUnits.QRT),
                    83, 97, 87);
            updateMessages(
                    String.format("Creando la cabecera para los: 'values Units' %s", TypeUnits.YTD.name()));
            createHeaderValues(newSheet, sheet, getCellStyleValues(workbook, TypeValues.UNITS, TypeUnits.YTD),
                    97, 102, 101);
            updateMessages(
                    String.format("Creando la cabecera para los: 'values Units' %s", TypeUnits.MAT.name()));
            createHeaderValues(newSheet, sheet, getCellStyleValues(workbook, TypeValues.UNITS, TypeUnits.MAT),
                    102, 107, 106);
            //            
            //            // seccion para los values units standars
            updateMessages(String.format("Creando la cabecera para los: 'values Standard Units' %s",
                    TypeUnits.MTH.name()));
            createHeaderValues(newSheet, sheet, getCellStyleValues(workbook, TypeValues.U_E, TypeUnits.MTH),
                    107, 131, 112);
            updateMessages(String.format("Creando la cabecera para los: 'values Standard Units' %s",
                    TypeUnits.QRT.name()));
            createHeaderValues(newSheet, sheet, getCellStyleValues(workbook, TypeValues.U_E, TypeUnits.QRT),
                    131, 145, 136);
            updateMessages(String.format("Creando la cabecera para los: 'values Standard Units' %s",
                    TypeUnits.YTD.name()));
            createHeaderValues(newSheet, sheet, getCellStyleValues(workbook, TypeValues.U_E, TypeUnits.YTD),
                    145, 150, 150);
            updateMessages(String.format("Creando la cabecera para los: 'values Standard Units' %s",
                    TypeUnits.MAT.name()));
            createHeaderValues(newSheet, sheet, getCellStyleValues(workbook, TypeValues.U_E, TypeUnits.MAT),
                    150, 155, 155);

            // fin de la seccion para la creacion de los encabezados

            // seccion para escribir los CT
            updateMessages("Escribiendo las clases terampeuticas...");
            writeCT(newSheet, sheet, 13, endRow);

            // seccion para escribir los productos
            updateMessages("Escribiendo los productos...");
            writeProducts(newSheet, sheet, 14);

            // seccion para escribir los otros valores
            updateMessages("Escribiendo datos en general...");
            writerOthersValues(newSheet, sheet, 15);

            // seccion para escribir los key competitors
            updateMessages("Escribiendo los Key Competitors...");
            writeKeyCompetitors(newSheet, 3, endRow, 9, 5);

            // seccion para escribir el pais
            XmlContry contry = writeContries(newSheet, 3, 0, input);

            // seccion para escribir la region
            writeRegions(contry, newSheet, 3, 1);

            for (int i = 0; i < 155; i++)
                newSheet.autoSizeColumn(i);

            newSheet.setAutoFilter(CellRangeAddress.valueOf(String.format("A3:K%d", newSheet.getLastRowNum())));

            String pathOutput = "DAS PF - " + input.getFileName().toString();

            try (FileOutputStream fos = new FileOutputStream(
                    Paths.get(this.out.toString(), pathOutput).toFile())) {

                updateMessages(String.format("Guadando el trabajo en la ruta: '%s'",
                        Paths.get(this.out.toString(), pathOutput)));

                workbook.write(fos);
            } catch (IOException ex) {
                Logger.getLogger(IOExcel.class.getName()).log(Level.SEVERE, null, ex);
            } finally {
                workbook.close();
            }

            if (openFile && Desktop.isDesktopSupported()
                    && Desktop.getDesktop().isSupported(Desktop.Action.OPEN))
                Desktop.getDesktop().open(Paths.get(this.out.toString(), pathOutput).toFile());

            result = true;

            newSheet = null;
            sheet = null;
            workbook = null;

            Files.delete(copy);
        }
    } catch (IOException | InvalidFormatException ex) {
        Logger.getLogger(IOExcel.class.getName()).log(Level.SEVERE, null, ex);

        Util.showException("No se pudo guardar el archivo", ex);
    }

    return result;
}

From source file:das.pf.io.IOExcel.java

License:Open Source License

public boolean consolidateFiles() {
    boolean result = false;
    AtomicInteger rowIndex = new AtomicInteger(3);

    String outputName = "DAS - " + this.out.getFileName().toString() + " consolidate.xlsx";
    Workbook consolidateWb = new XSSFWorkbook();

    try {//from  w  ww . j  a  v a 2 s. c om
        Sheet sheetConsolidate = consolidateWb.createSheet("Consolidado");

        Files.list(this.out).filter((p) -> {
            String name = p.toString();

            return (name.endsWith(".xlsx") || name.endsWith(".xls"))
                    && !p.getFileName().toString().equals(outputName);
        }).sorted((p1, p2) -> {
            String acronym = getAcromynName(p1);
            String acronym2 = getAcromynName(p2);

            return acronym.compareToIgnoreCase(acronym2);
        }).forEach(p -> {
            try {
                Workbook wb = WorkbookFactory.create(p.toFile());
                Sheet sheet = wb.getSheet("Procesado");

                updateMessages(String.format("Copiando los datos del archivo: %s dentro del archivo: %s",
                        p.toString(), outputName));

                for (int index = 3; index < sheet.getLastRowNum(); index++) {
                    Row row = sheet.getRow(index);
                    Row r = sheetConsolidate.createRow(rowIndex.getAndIncrement());

                    row.forEach(c -> {
                        if (c != null && c.getCellType() != Cell.CELL_TYPE_BLANK) {
                            final Cell cell = r.createCell(c.getColumnIndex(), c.getCellType());

                            updateMessages(
                                    String.format("Copiando los datos de la fila: #%d", c.getRowIndex()));

                            switch (c.getCellType()) {
                            case Cell.CELL_TYPE_NUMERIC:
                                cell.setCellValue(c.getNumericCellValue());

                                break;

                            case Cell.CELL_TYPE_STRING:
                                cell.setCellValue(c.getRichStringCellValue());

                                break;
                            }
                        }
                    });

                    row = null;
                }

                sheet = null;
                wb.close();
                wb = null;
            } catch (IOException | InvalidFormatException | EncryptedDocumentException ex) {
                Logger.getLogger(IOExcel.class.getName()).log(Level.SEVERE, null, ex);
            }
        });

        Path path = Files.list(this.out).filter((p) -> {
            String name = p.toString();

            return (name.endsWith(".xlsx") || name.endsWith(".xls"))
                    && !p.getFileName().toString().equals(outputName);
        }).findFirst().get();

        createHeadersConsolidateFile(consolidateWb, path);

        for (int i = 0; i < 155; i++)
            sheetConsolidate.autoSizeColumn(i);

        sheetConsolidate.setAutoFilter(
                CellRangeAddress.valueOf(String.format("A3:K%d", sheetConsolidate.getLastRowNum())));

        try (FileOutputStream fos = new FileOutputStream(Paths.get(out.toString(), outputName).toFile())) {
            updateMessages(String.format("Guadando el trabajo en la ruta: '%s'",
                    Paths.get(this.out.toString(), outputName)));

            consolidateWb.write(fos);

            result = true;
        } catch (IOException ex) {
            Logger.getLogger(IOExcel.class.getName()).log(Level.SEVERE,
                    "Ocurrio un error al intenatr guardar el archivo consolidado", ex);
        } finally {
            consolidateWb.close();
        }

    } catch (IOException ex) {
        Logger.getLogger(IOExcel.class.getName()).log(Level.SEVERE, null, ex);
    }

    consolidateWb = null;

    return result;
}

From source file:Data.Database.java

public void dumpExcel() throws FileNotFoundException, IOException {
    //Workbook wb = new HSSFWorkbook();
    Workbook wb = new XSSFWorkbook();
    CreationHelper createHelper = wb.getCreationHelper();
    Sheet sheet = wb.createSheet("leaguedata");

    // set headers on excel sheet
    Row row = sheet.createRow((short) 0);
    String headers[] = new String[] { "Team", "Player", "Position", "Age", "Yrs Played", "GP", "G", "A", "PTS",
            "+/-", "STP", "SOG", "SH%", "Hits", "Blocks", "TOI", "G/60", "A/60", "PTS/60", "STP/60", "SOG/60",
            "Hits/60", "Blocks/60" };

    for (int i = 0; i < headers.length; i++) {
        Cell cell = row.createCell(i);/*  www.j  ava 2s.  com*/
        cell.setCellValue(createHelper.createRichTextString(headers[i]));
        CellStyle cellStyle = wb.createCellStyle();
        cellStyle.setAlignment(CellStyle.ALIGN_CENTER);
        cell.setCellStyle(cellStyle);
    }

    // add player data
    int track = 2;

    //        // dump ALL players!!!!!
    //        for (Map.Entry<String, Player> entry : players.entrySet()){
    //            Row newrow = sheet.createRow((short)track);
    //            entry.getValue().dumpExcel(newrow, "null");
    //            track++;
    //        }
    //        
    //                // Write the output to a file
    //        FileOutputStream fileOut = new FileOutputStream("RFHL_allplayers.xlsx");
    //        wb.write(fileOut);
    //        fileOut.close();

    // dump fantasy teams!!!
    for (int i = 0; i < fh_teams.size(); i++) {
        track = fh_teams.get(i).dumpExcel(sheet, track);
        track++;
    }

    // Write the output to a file
    FileOutputStream fileOut = new FileOutputStream("RFHL.xlsx");
    wb.write(fileOut);
    fileOut.close();

}