Example usage for org.apache.poi.xssf.usermodel XSSFCellStyle setFillPattern

List of usage examples for org.apache.poi.xssf.usermodel XSSFCellStyle setFillPattern

Introduction

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

Prototype

@Override
public void setFillPattern(FillPatternType pattern) 

Source Link

Document

This element is used to specify cell fill information for pattern and solid color cell fills.

Usage

From source file:nl.detoren.ijsco.io.ExcelExport.java

License:Open Source License

public void exportGroepen(Groepen groepen) {
    String password = "abcd";
    try {//  w  w  w.  j a  v a 2 s.  c  o m
        if (groepen == null)
            return;
        // sheetindx geeft index in Excel template op basis van groepsgrootte. -1: geen sheet voor groepsgrootte 
        int[] sheetindx = new int[] { -1, -1, -1, -1, 5, -1, 4, -1, 3, -1, 2, -1, 1, -1, 0, -1, -1, -1 };
        // columnsize geeft lengte in Excel template op basis van groepsgrootte. -1: geen sheet voor groepsgrootte
        int[] columnsize = new int[] { -1, -1, -1, -1, 20, -1, 35, -1, 54, -1, 77, -1, 100, -1, 127, -1, -1,
                -1 };
        // pagelngth geeft lengte in Excel template op basis van groepsgrootte. -1: geen sheet voor groepsgrootte
        int[] pagelngth = new int[] { -1, -1, -1, -1, 20, -1, 35, -1, 54, -1, 77, -1, 100, -1, 127, -1, -1,
                -1 };
        int sheet2row = 2;
        int sheet3row = 2;
        FileInputStream file = new FileInputStream("Indeling.xlsm");
        XSSFWorkbook workbook = new XSSFWorkbook(file);
        XSSFCellStyle style1 = workbook.createCellStyle();
        style1.setFillPattern(FillPatternType.SOLID_FOREGROUND);
        style1.setFillForegroundColor(new XSSFColor(new java.awt.Color(180, 180, 180)));
        XSSFCellStyle my_style = workbook.createCellStyle();
        XSSFColor my_foreground = new XSSFColor(Color.ORANGE);
        XSSFColor my_background = new XSSFColor(Color.RED);
        my_style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
        my_style.setFillForegroundColor(my_foreground);
        my_style.setFillBackgroundColor(my_background);
        XSSFSheet sheet2 = workbook.getSheet("Groepsindeling");
        XSSFSheet sheet3 = workbook.getSheet("Deelnemerslijst");
        updateCell(sheet3, sheet3row, 0, "Naam", style1);
        updateCell(sheet3, sheet3row, 1, "KNSB nr", style1);
        updateCell(sheet3, sheet3row, 2, "rating", style1);
        updateCell(sheet3, sheet3row, 3, "groep", style1);
        sheet3row++;
        for (Groep groep : groepen) {
            logger.log(Level.INFO, "Exporteer groep : " + groep.getNaam());
            XSSFSheet sheet = workbook.cloneSheet(sheetindx[groep.getGrootte()], groep.getNaam());
            updateCell(sheet, 0, 6, groep.getNaam());
            updateCell(sheet2, sheet2row, 1, groep.getNaam());
            sheet2row++;
            updateCell(sheet2, sheet2row, 0, "nr", style1);
            updateCell(sheet2, sheet2row, 1, "Naam", style1);
            updateCell(sheet2, sheet2row, 2, "KNSB nr", style1);
            updateCell(sheet2, sheet2row, 3, "rating", style1);
            sheet2row++;
            for (int i = 0; i < groep.getGrootte(); i++) {
                updateCell(sheet, 3 + i, 2, groep.getSpeler(i).getNaam());
                updateCell(sheet, 3 + i, 3, groep.getSpeler(i).getKnsbnummer());
                updateCell(sheet, 3 + i, 5, groep.getSpeler(i).getRating());
                updateCell(sheet2, sheet2row, 0, i + 1);
                updateCell(sheet2, sheet2row, 1,
                        "'" + sheet.getSheetName() + "'!"
                                + org.apache.poi.ss.util.CellReference.convertNumToColString(2) + (4 + i),
                        true);
                updateCell(sheet2, sheet2row, 2,
                        "'" + sheet.getSheetName() + "'!"
                                + org.apache.poi.ss.util.CellReference.convertNumToColString(3) + (4 + i),
                        true);
                updateCell(sheet2, sheet2row, 3,
                        "'" + sheet.getSheetName() + "'!"
                                + org.apache.poi.ss.util.CellReference.convertNumToColString(5) + (4 + i),
                        true);
                if (groep.getSpeler(i).getNaam() != "Bye") {
                    updateCell(sheet3, sheet3row, 0,
                            "'" + sheet.getSheetName() + "'!"
                                    + org.apache.poi.ss.util.CellReference.convertNumToColString(2) + (4 + i),
                            true);
                    updateCell(sheet3, sheet3row, 1,
                            "'" + sheet.getSheetName() + "'!"
                                    + org.apache.poi.ss.util.CellReference.convertNumToColString(3) + (4 + i),
                            true);
                    updateCell(sheet3, sheet3row, 2,
                            "'" + sheet.getSheetName() + "'!"
                                    + org.apache.poi.ss.util.CellReference.convertNumToColString(5) + (4 + i),
                            true);
                    updateCell(sheet3, sheet3row, 3, groep.getNaam());
                }
                sheet2row++;
                sheet3row++;
            }
            sheet2row++;
            sheet.setForceFormulaRecalculation(true);
            // Set print margins
            XSSFPrintSetup ps = sheet.getPrintSetup();
            ps.setLandscape(true);
            ps.setFitWidth((short) 1);
            sheet.setFitToPage(true);
            sheet.setAutobreaks(false);
            workbook.setPrintArea(workbook.getSheetIndex(sheet), 1, 26, 0, pagelngth[groep.getGrootte()]);
            sheet.setColumnBreak(18);
            sheet.protectSheet(password);
            sheet.enableLocking();
        }
        XSSFSheet sheet4 = workbook.cloneSheet(workbook.getSheetIndex(sheet3), "Deelnemerslijst (naam)");
        sortSheet(sheet4, 1, 3, 62);
        //XSSFSheet sheet5 = workbook.cloneSheet(workbook.getSheetIndex(sheet3), "Deelnemerslijst (rating)");
        //sortSheet(sheet5, 1,4);
        sheet2.protectSheet(password);
        sheet3.protectSheet(password);
        sheet4.protectSheet(password);
        //sheet5.protectSheet(password);
        // Remove template sheets
        for (int i = 0; i < 6; i++) {
            workbook.removeSheetAt(0);
        }

        // Close input file
        file.close();
        // Store Excel to new file
        String filename = "Indeling resultaat.xlsm";
        File outputFile = new File(filename);
        FileOutputStream outFile = new FileOutputStream(outputFile);
        workbook.write(outFile);
        // Close output file
        workbook.close();
        outFile.close();
        // And open it in the system editor
        Desktop.getDesktop().open(outputFile);
    } catch (IOException e) {
        logger.log(Level.SEVERE, "Fout bij maken indeling excel : " + e.getMessage());

    }
}

From source file:org.azkfw.document.database.xlsx.XLSXWriter.java

License:Apache License

private XSSFSheet createTableListSheet(final DatabaseModel datasource, final XSSFSheet sheet) {
    // /*  ww w .j  a v a2  s .com*/
    sheet.setColumnWidth(0, 640 * 1);
    sheet.setColumnWidth(1, 640 * 2); // No
    sheet.setColumnWidth(2, 640 * 10); // ???
    sheet.setColumnWidth(3, 640 * 10); // ???
    sheet.setColumnWidth(4, 640 * 15); // 
    sheet.setColumnWidth(5, 640 * 1);

    /////////////////////////////////////////////////////////////////////
    XSSFCellStyle styleLabel = workbook.createCellStyle();
    styleLabel.setFillPattern(CellStyle.SOLID_FOREGROUND);
    styleLabel.setFillForegroundColor(IndexedColors.LIGHT_GREEN.getIndex());
    styleLabel.setFont(fontLabel);
    styleLabel.setBorderTop(CellStyle.BORDER_THIN);
    styleLabel.setBorderBottom(CellStyle.BORDER_THIN);
    styleLabel.setBorderLeft(CellStyle.BORDER_THIN);
    styleLabel.setBorderRight(CellStyle.BORDER_THIN);

    XSSFCellStyle styleValue1 = workbook.createCellStyle();
    styleValue1.setFillPattern(CellStyle.SOLID_FOREGROUND);
    styleValue1.setFillForegroundColor(IndexedColors.WHITE.getIndex());
    styleValue1.setFont(fontValue);
    styleValue1.setBorderTop(CellStyle.BORDER_DOTTED);
    styleValue1.setBorderBottom(CellStyle.BORDER_DOTTED);
    styleValue1.setBorderLeft(CellStyle.BORDER_THIN);
    styleValue1.setBorderRight(CellStyle.BORDER_THIN);

    XSSFCellStyle styleValue2 = workbook.createCellStyle();
    styleValue2.setFillPattern(CellStyle.SOLID_FOREGROUND);
    styleValue2.setFillForegroundColor(IndexedColors.WHITE.getIndex());
    styleValue2.setFont(fontLink);
    styleValue2.setBorderTop(CellStyle.BORDER_DOTTED);
    styleValue2.setBorderBottom(CellStyle.BORDER_DOTTED);
    styleValue2.setBorderLeft(CellStyle.BORDER_THIN);
    styleValue2.setBorderRight(CellStyle.BORDER_THIN);

    /////////////////////////////////////////////////////////////////////
    XSSFRow row = null;
    @SuppressWarnings("unused")
    XSSFCell cell = null;
    int rowIndex = 1;

    ////////////////////////////////////////////////////////////////////////////
    // 
    ////////////////////////////////////////////////////////////////////////////

    row = sheet.createRow(rowIndex); ///////////////////////////////////////////
    cell = createCell(1, Strings.get("doc.table_list"), styleTitle, row);

    List<TableModel> tables = datasource.getTables();

    short top = BD_RECT;
    short bottom = CellStyle.BORDER_THIN;
    if (0 == tables.size()) {
        bottom = BD_RECT;
    }

    rowIndex++;
    row = sheet.createRow(rowIndex); ///////////////////////////////////////////
    cell = createCell(1, Strings.get("doc.no"),
            styleManager.get(defStyleLabel, top, bottom, BD_RECT, CellStyle.BORDER_THIN), row);
    cell = createCell(2, Strings.get("doc.logic_table_name"),
            styleManager.get(defStyleLabel, top, bottom, CellStyle.BORDER_THIN, CellStyle.BORDER_THIN), row);
    cell = createCell(3, Strings.get("doc.physical_table_name"),
            styleManager.get(defStyleLabel, top, bottom, CellStyle.BORDER_THIN, CellStyle.BORDER_THIN), row);
    cell = createCell(4, Strings.get("doc.memo"),
            styleManager.get(defStyleLabel, top, bottom, CellStyle.BORDER_THIN, BD_RECT), row);

    rowIndex++;
    for (int i = 0; i < tables.size(); i++) {
        int bufRowIndex = rowIndex + i;
        TableModel table = tables.get(i);

        Hyperlink link = createTableLink(table.getName());

        top = CellStyle.BORDER_DOTTED;
        bottom = CellStyle.BORDER_DOTTED;
        if (i == 0) {
            top = CellStyle.BORDER_THIN;
        }
        if (i + 1 == tables.size()) {
            bottom = BD_RECT;
        }

        row = sheet.createRow(bufRowIndex); ///////////////////////////////////////////
        cell = createCell(1, String.format("%d", i + 1),
                styleManager.get(defStyleListValueNo, top, bottom, BD_RECT, CellStyle.BORDER_THIN), row);
        cell = createCell(2, table.getLabel(),
                styleManager.get(defStyleListValue, top, bottom, CellStyle.BORDER_THIN, CellStyle.BORDER_THIN),
                row);
        cell = createCell(3, table.getName(), styleManager.get(defStyleListValueLink, top, bottom,
                CellStyle.BORDER_THIN, CellStyle.BORDER_THIN), link, row);
        cell = createCell(4, table.getComment(),
                styleManager.get(defStyleListValue, top, bottom, CellStyle.BORDER_THIN, BD_RECT), row);
    }
    rowIndex += tables.size();

    workbook.setPrintArea(workbook.getSheetIndex(getTableListSheetName()), 0, 5, 0, rowIndex);
    sheet.setAutobreaks(true);
    XSSFPrintSetup printSetup = sheet.getPrintSetup();
    printSetup.setFitWidth((short) 1);
    printSetup.setScale((short) 95);

    return sheet;
}

From source file:org.displaytag.render.XssfTableWriter.java

License:Artistic License

/**
 * Obtain the style used to render a header or footer.
 * @return The style used to render a header or footer.
 *///from w w  w  .ja  v  a 2  s .  c  o  m
private XSSFCellStyle getHeaderFooterStyle() {
    XSSFFont font = this.wb.createFont();
    font.setColor(IndexedColors.WHITE.getIndex());
    font.setBold(true);
    font.setBoldweight(XSSFFont.BOLDWEIGHT_BOLD);
    font.setItalic(false);

    XSSFCellStyle style = this.wb.createCellStyle();
    style.setFillPattern(XSSFCellStyle.FINE_DOTS);
    style.setFillBackgroundColor(IndexedColors.BLUE_GREY.getIndex());
    style.setFont(font);
    return style;
}

From source file:org.gaia.gui.reports.ExcelReportExporter.java

License:Open Source License

/**
 * generate file EXCEL//from   w w w  . j  av  a2  s  . co  m
 *
 * @param table
 * @param template
 */
public static void generateExcel(SortableTreeTable table, ReportTemplate template) {
    FileOutputStream fileOut = null;
    XSSFWorkbook wb = new XSSFWorkbook();
    try {
        String excelFilename = generateFileName(template);
        fileOut = new FileOutputStream(excelFilename);

        List<TemplateColumnItem> items = ReportBuilder.orderColumns(template.getTemplateColumnItems());
        TemplateColumnItem item;
        int colMax = table.getColumnModel().getColumnCount();
        if (items.size() < colMax) {
            colMax = items.size();
        }

        XSSFSheet bomSheet = (XSSFSheet) wb.createSheet(template.getTemplateName());

        XSSFRow headerRow = (XSSFRow) bomSheet.createRow(0);
        XSSFCellStyle headerStyle = (XSSFCellStyle) wb.createCellStyle();
        Font font = wb.createFont();
        font.setBoldweight(XSSFFont.BOLDWEIGHT_BOLD);
        font.setFontName("Tahoma");
        headerStyle.setFont(font);
        headerStyle.setBorderBottom(XSSFCellStyle.BORDER_THIN);
        headerStyle.setBorderTop(XSSFCellStyle.BORDER_THIN);
        headerStyle.setBorderLeft(XSSFCellStyle.BORDER_THIN);
        headerStyle.setBorderRight(XSSFCellStyle.BORDER_THIN);
        headerStyle.setFillForegroundColor(HSSFColor.LIGHT_GREEN.index);
        headerStyle.setFillPattern(XSSFCellStyle.SOLID_FOREGROUND);
        for (int i = 0; i < colMax; i++) {
            XSSFCell cell = (XSSFCell) headerRow.createCell(i);
            cell.setCellType(XSSFCell.CELL_TYPE_STRING);
            cell.setCellValue(table.getColumnName(i));
            cell.setCellStyle(headerStyle);
        }

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

        font = wb.createFont();
        font.setFontName("Tahoma");
        cellStyle.setFont(font);
        cellStyle.setBorderBottom(XSSFCellStyle.BORDER_THIN);
        cellStyle.setBorderTop(XSSFCellStyle.BORDER_THIN);
        cellStyle.setBorderLeft(XSSFCellStyle.BORDER_THIN);
        cellStyle.setBorderRight(XSSFCellStyle.BORDER_THIN);
        for (int j = 0; j < table.getRowCount(); j++) {
            XSSFRow row = (XSSFRow) bomSheet.createRow(j + 1);
            for (int i = 0; i < colMax; i++) {
                XSSFCell cell = (XSSFCell) row.createCell(i);
                cell.setCellStyle(cellStyle);
                Object value = table.getValueAt(j, i);
                item = (TemplateColumnItem) items.get(i);
                if (value != null && !value.equals(StringUtils.EMPTY_STRING)) {
                    Class<?> clazz = Class.forName(item.getReturnType());

                    //used for Snapshot Export
                    if (clazz == String.class && NumberUtils.isInteger(value.toString())) {
                        clazz = Integer.class;
                    } else if (clazz == String.class && NumberUtils.isNumber(value.toString())) {
                        clazz = BigDecimal.class;
                    }

                    if (short.class.isAssignableFrom(clazz) || Short.class.isAssignableFrom(clazz)) {
                        cell.setCellType(XSSFCell.CELL_TYPE_NUMERIC);
                        cell.setCellValue(((Short) value).intValue());
                    } else if (int.class.isAssignableFrom(clazz) || Integer.class.isAssignableFrom(clazz)) {
                        cell.setCellType(XSSFCell.CELL_TYPE_NUMERIC);
                        cell.setCellValue(Integer.parseInt(value.toString()));
                    } else if (long.class.isAssignableFrom(clazz) || Long.class.isAssignableFrom(clazz)) {
                        cell.setCellType(XSSFCell.CELL_TYPE_NUMERIC);
                        cell.setCellValue(((Long) value).intValue());
                    } else if (float.class.isAssignableFrom(clazz) || Float.class.isAssignableFrom(clazz)) {
                        cell.setCellType(XSSFCell.CELL_TYPE_NUMERIC);
                        cell.setCellValue(((Float) value).doubleValue());
                    } else if (BigDecimal.class.isAssignableFrom(clazz)) {
                        cell.setCellType(XSSFCell.CELL_TYPE_NUMERIC);
                        cell.setCellValue(Double.parseDouble(value.toString()));
                    } else if (double.class.isAssignableFrom(clazz) || Double.class.isAssignableFrom(clazz)) {
                        cell.setCellType(XSSFCell.CELL_TYPE_NUMERIC);
                        cell.setCellValue((Double) value);
                    } else if (Date.class.isAssignableFrom(clazz)) {
                        cell.setCellType(XSSFCell.CELL_TYPE_NUMERIC);
                        cell.setCellValue(HSSFDateUtil.getExcelDate((java.sql.Date) value));
                    } else {
                        cell.setCellType(XSSFCell.CELL_TYPE_STRING);
                        cell.setCellValue(value.toString());
                    }
                }
            }

        }

        for (int i = 0; i < table.getColumnModel().getColumnCount(); i++) {
            bomSheet.autoSizeColumn(i);
        }

        SortableTreeTableModel model = (SortableTreeTableModel) table.getTreeTableModel();
        AbstractSortableTreeTableNode root = (AbstractSortableTreeTableNode) model.getRoot();
        groupNode(root, bomSheet);
        wb.write(fileOut);
        fileOut.flush();
        fileOut.close();
        nodeList.clear();
        groupList.clear();
        allNodeList.clear();

        openExcel(excelFilename);
    } catch (ClassNotFoundException | IOException ex) {
        Exceptions.printStackTrace(ex);
    } finally {
        try {
            fileOut.close();
        } catch (IOException ex) {
            logger.error(ex);
        }
    }
}

From source file:org.jboss.windup.reporting.spreadsheet.ScorecardReporter.java

License:Open Source License

private static void appendTitleRow(XSSFWorkbook wb, XSSFSheet sheet, int rowNum) {
    XSSFCellStyle titleCell = wb.createCellStyle();
    Color titleCellGrey = new Color(0xECECEC);
    XSSFColor color = new XSSFColor(titleCellGrey);
    titleCell.setFillForegroundColor(color);
    titleCell.setBorderBottom(CellStyle.BORDER_MEDIUM);
    titleCell.setFillPattern(CellStyle.SOLID_FOREGROUND);

    Font titleFormat = wb.createFont();
    titleFormat.setBoldweight(Font.BOLDWEIGHT_BOLD);
    titleFormat.setColor((short) 0x0);
    titleCell.setFont(titleFormat);/*  w  ww. j a  v  a  2  s. c o m*/

    XSSFRow row = sheet.createRow(rowNum);
    XSSFCell t1 = row.createCell(0);
    t1.setCellValue("Application Migration Estimate");
    t1.setCellStyle(titleCell);

    XSSFCell t2 = row.createCell(1);
    t2.setCellValue("Effort (Points)");
    t2.setCellStyle(titleCell);

    XSSFCell t3 = row.createCell(2);
    t3.setCellStyle(titleCell);

    XSSFCell t4 = row.createCell(3);
    t4.setCellValue("Notes");
    t4.setCellStyle(titleCell);
}

From source file:org.jboss.windup.reporting.spreadsheet.ScorecardReporter.java

License:Open Source License

private static void appendMentoringTitleRow(XSSFWorkbook wb, XSSFSheet sheet, int rowNum) {
    XSSFCellStyle titleCell = wb.createCellStyle();
    Color titleCellGrey = new Color(0xECECEC);
    XSSFColor color = new XSSFColor(titleCellGrey);
    titleCell.setFillForegroundColor(color);
    titleCell.setBorderBottom(CellStyle.BORDER_MEDIUM);
    titleCell.setBorderTop(CellStyle.BORDER_MEDIUM);
    titleCell.setFillPattern(CellStyle.SOLID_FOREGROUND);

    Font titleFormat = wb.createFont();
    titleFormat.setBoldweight(Font.BOLDWEIGHT_BOLD);
    titleFormat.setColor((short) 0x0);
    titleCell.setFont(titleFormat);/*from   ww  w  .  j a  v a 2 s  . c o  m*/

    XSSFRow row = sheet.createRow(rowNum);
    XSSFCell t1 = row.createCell(0);
    t1.setCellValue("Migration Service Estimate");
    t1.setCellStyle(titleCell);

    XSSFCell t2 = row.createCell(1);
    t2.setCellStyle(titleCell);

    XSSFCell t3 = row.createCell(2);
    t3.setCellStyle(titleCell);

    XSSFCell t4 = row.createCell(3);
    t4.setCellStyle(titleCell);
}

From source file:org.nekorp.workflow.desktop.servicio.reporte.cliente.AbstractSeccionXLS.java

License:Apache License

public void addHeaderStyle(XSSFCellStyle cellStyle, XSSFWorkbook wb) {
    cellStyle.setAlignment(CellStyle.ALIGN_CENTER);
    cellStyle.setFillForegroundColor(new XSSFColor(new java.awt.Color(85, 142, 213)));
    cellStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
    XSSFFont font = wb.createFont();/*from www  .  j ava2s.  co  m*/
    font.setColor(IndexedColors.WHITE.getIndex());
    font.setBold(true);
    cellStyle.setFont(font);
}

From source file:packtest.CalendarDemo.java

License:Apache License

/**
 * cell styles used for formatting calendar sheets
 *//*from   www.  j  a v a  2  s.c o  m*/
private static Map<String, XSSFCellStyle> createStyles(XSSFWorkbook wb) {
    Map<String, XSSFCellStyle> styles = new HashMap<String, XSSFCellStyle>();

    XSSFCellStyle style;
    XSSFFont titleFont = wb.createFont();
    titleFont.setFontHeightInPoints((short) 48);
    titleFont.setColor(new XSSFColor(new java.awt.Color(39, 51, 89)));
    style = wb.createCellStyle();
    style.setAlignment(HorizontalAlignment.CENTER);
    style.setVerticalAlignment(VerticalAlignment.CENTER);
    style.setFont(titleFont);
    styles.put("title", style);

    XSSFFont monthFont = wb.createFont();
    monthFont.setFontHeightInPoints((short) 12);
    monthFont.setColor(new XSSFColor(new java.awt.Color(255, 255, 255)));
    monthFont.setBold(true);
    style = wb.createCellStyle();
    style.setAlignment(HorizontalAlignment.CENTER);
    style.setVerticalAlignment(VerticalAlignment.CENTER);
    style.setFillForegroundColor(new XSSFColor(new java.awt.Color(39, 51, 89)));
    style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    style.setFont(monthFont);
    styles.put("month", style);

    XSSFFont dayFont = wb.createFont();
    dayFont.setFontHeightInPoints((short) 14);
    dayFont.setBold(true);
    style = wb.createCellStyle();
    style.setAlignment(HorizontalAlignment.LEFT);
    style.setVerticalAlignment(VerticalAlignment.TOP);
    style.setFillForegroundColor(new XSSFColor(new java.awt.Color(228, 232, 243)));
    style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    style.setBorderLeft(BorderStyle.THIN);
    style.setLeftBorderColor(new XSSFColor(new java.awt.Color(39, 51, 89)));
    style.setBorderBottom(BorderStyle.THIN);
    style.setBottomBorderColor(new XSSFColor(new java.awt.Color(39, 51, 89)));
    style.setFont(dayFont);
    styles.put("weekend_left", style);

    style = wb.createCellStyle();
    style.setAlignment(HorizontalAlignment.CENTER);
    style.setVerticalAlignment(VerticalAlignment.TOP);
    style.setFillForegroundColor(new XSSFColor(new java.awt.Color(228, 232, 243)));
    style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    style.setBorderRight(BorderStyle.THIN);
    style.setRightBorderColor(new XSSFColor(new java.awt.Color(39, 51, 89)));
    style.setBorderBottom(BorderStyle.THIN);
    style.setBottomBorderColor(new XSSFColor(new java.awt.Color(39, 51, 89)));
    styles.put("weekend_right", style);

    style = wb.createCellStyle();
    style.setAlignment(HorizontalAlignment.LEFT);
    style.setVerticalAlignment(VerticalAlignment.TOP);
    style.setBorderLeft(BorderStyle.THIN);
    style.setFillForegroundColor(new XSSFColor(new java.awt.Color(255, 255, 255)));
    style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    style.setLeftBorderColor(new XSSFColor(new java.awt.Color(39, 51, 89)));
    style.setBorderBottom(BorderStyle.THIN);
    style.setBottomBorderColor(new XSSFColor(new java.awt.Color(39, 51, 89)));
    style.setFont(dayFont);
    styles.put("workday_left", style);

    style = wb.createCellStyle();
    style.setAlignment(HorizontalAlignment.CENTER);
    style.setVerticalAlignment(VerticalAlignment.TOP);
    style.setFillForegroundColor(new XSSFColor(new java.awt.Color(255, 255, 255)));
    style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    style.setBorderRight(BorderStyle.THIN);
    style.setRightBorderColor(new XSSFColor(new java.awt.Color(39, 51, 89)));
    style.setBorderBottom(BorderStyle.THIN);
    style.setBottomBorderColor(new XSSFColor(new java.awt.Color(39, 51, 89)));
    styles.put("workday_right", style);

    style = wb.createCellStyle();
    style.setBorderLeft(BorderStyle.THIN);
    style.setFillForegroundColor(new XSSFColor(new java.awt.Color(234, 234, 234)));
    style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    style.setBorderBottom(BorderStyle.THIN);
    style.setBottomBorderColor(new XSSFColor(new java.awt.Color(39, 51, 89)));
    styles.put("grey_left", style);

    style = wb.createCellStyle();
    style.setFillForegroundColor(new XSSFColor(new java.awt.Color(234, 234, 234)));
    style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    style.setBorderRight(BorderStyle.THIN);
    style.setRightBorderColor(new XSSFColor(new java.awt.Color(39, 51, 89)));
    style.setBorderBottom(BorderStyle.THIN);
    style.setBottomBorderColor(new XSSFColor(new java.awt.Color(39, 51, 89)));
    styles.put("grey_right", style);

    return styles;
}

From source file:pe.gob.mef.gescon.util.ExcelUtil.java

/**
 * Mtodo que crea el estilo para las filas impares.
 * @return estilo Estilo creado, tipo XSSFCellStyle.
 *///www . j a va  2 s .  c  om
public XSSFCellStyle creaEstiloFilaImpar() {
    XSSFCellStyle estilo = (XSSFCellStyle) this.libroExcel.createCellStyle();
    Font fuente = creaFuenteFilaImpar();
    estilo.setFont(fuente);
    estilo.setFillForegroundColor(new XSSFColor(new java.awt.Color(202, 225, 255)));
    estilo.setFillPattern(XSSFCellStyle.SOLID_FOREGROUND);
    return estilo;
}

From source file:pe.gob.mef.gescon.util.ExcelUtil.java

/**
 * Mtodo que crea el estilo para las filas impares con borde derecho.
 * @return estilo Estilo creado, tipo XSSFCellStyle.
 *///from   www.j  a va2 s.  c o m
public XSSFCellStyle crearEstiloBordeDerechoImpar() {
    XSSFCellStyle estilo = (XSSFCellStyle) this.libroExcel.createCellStyle();
    estilo.setBorderRight(XSSFCellStyle.BORDER_THIN);
    Font fuente = creaFuenteFilaImpar();
    estilo.setFont(fuente);
    estilo.setFillForegroundColor(new XSSFColor(new java.awt.Color(202, 225, 255)));
    estilo.setFillPattern(XSSFCellStyle.SOLID_FOREGROUND);
    return estilo;
}