Java 类org.apache.poi.ss.usermodel.IndexedColors 实例源码

项目:vaadin-gridexport    文件:ExcelExport.java   
/**
 * Returns the default data cell style. Obtained from:
 * http://svn.apache.org/repos/asf/poi
 * /trunk/src/examples/src/org/apache/poi/ss/examples/TimesheetDemo.java
 *
 * @param wb the wb
 * @return the cell style
 */
protected CellStyle defaultDataCellStyle(final Workbook wb) {
    CellStyle style;
    style = wb.createCellStyle();
    style.setAlignment(HorizontalAlignment.CENTER);
    style.setWrapText(true);
    style.setBorderRight(BorderStyle.THIN);
    style.setRightBorderColor(IndexedColors.BLACK.getIndex());
    style.setBorderLeft(BorderStyle.THIN);
    style.setLeftBorderColor(IndexedColors.BLACK.getIndex());
    style.setBorderTop(BorderStyle.THIN);
    style.setTopBorderColor(IndexedColors.BLACK.getIndex());
    style.setBorderBottom(BorderStyle.THIN);
    style.setBottomBorderColor(IndexedColors.BLACK.getIndex());
    style.setDataFormat(doubleDataFormat);
    return style;
}
项目:vaadin-gridexport    文件:ExcelExport.java   
/**
 * Returns the default header style. Obtained from:
 * http://svn.apache.org/repos/asf/poi
 * /trunk/src/examples/src/org/apache/poi/ss/examples/TimesheetDemo.java
 *
 * @param wb the wb
 * @return the cell style
 */
protected CellStyle defaultHeaderCellStyle(final Workbook wb) {
    CellStyle style;
    final Font monthFont = wb.createFont();
    monthFont.setFontHeightInPoints((short) 11);
    monthFont.setColor(IndexedColors.WHITE.getIndex());
    style = wb.createCellStyle();
    style.setAlignment(HorizontalAlignment.CENTER);
    style.setVerticalAlignment(VerticalAlignment.CENTER);
    style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
    style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    style.setFont(monthFont);
    style.setWrapText(true);
    return style;
}
项目:bingexcel    文件:AbstractWriteHandler.java   
CellStyle createHeadStyle() {
    if (headerCellStyle != null) {
        return headerCellStyle;
    }
    CellStyle style = wb.createCellStyle();
    // 设置这些样式
    style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.index);
    style.setFillPattern(CellStyle.SOLID_FOREGROUND);

    style.setAlignment(CellStyle.ALIGN_CENTER);
    // 生成一个字体
    Font font = wb.createFont();
    font.setColor(IndexedColors.BLACK.index);
    font.setFontHeightInPoints((short) 12);
    font.setBoldweight(Font.BOLDWEIGHT_BOLD);
    // 把字体应用到当前的样式
    style.setFont(font);
    headerCellStyle = style;
    return style;
}
项目:bingexcel    文件:AbstractWriteHandler.java   
CellStyle createHeadDateStyle() {
    if (headDateCellStyle != null) {
        return headDateCellStyle;
    }
    CellStyle cellStyle = wb.createCellStyle();
    DataFormat format = wb.createDataFormat();
    cellStyle.setDataFormat(format.getFormat("m/d/yy h:mm"));

    // 设置这些样式
    cellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.index);
    cellStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);

    cellStyle.setAlignment(CellStyle.ALIGN_CENTER);
    // 生成一个字体
    Font font = wb.createFont();
    font.setColor(IndexedColors.BLACK.index);
    font.setFontHeightInPoints((short) 12);
    font.setBoldweight(Font.BOLDWEIGHT_BOLD);
    // 把字体应用到当前的样式
    cellStyle.setFont(font);

    headDateCellStyle = cellStyle;
    return cellStyle;
}
项目:sigmah    文件:ExcelUtils.java   
private CellStyle createLinkStyle(boolean bordered) {
    final Font hlinkFont = wb.createFont();
    hlinkFont.setUnderline(Font.U_SINGLE);
    hlinkFont.setColor(IndexedColors.BLUE.getIndex());

    final CellStyle style;
    if (bordered) {
        style = createBorderedStyle(wb);
    } else {
        style = wb.createCellStyle();
    }

    style.setFont(hlinkFont);
    style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
    style.setIndention((short) 1);
    style.setWrapText(true);

    return style;
}
项目:ExcelHandle    文件:ExportExcel.java   
/**
     * 创建表格样式
     * @param wb 工作薄对象
     * @return 样式列表
     */
    private Map<String, CellStyle> createStyles(Workbook wb) {
        Map<String, CellStyle> styles = new HashMap<String, CellStyle>();

        CellStyle style = wb.createCellStyle();
        style.setAlignment(CellStyle.ALIGN_CENTER);
        style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
        Font titleFont = wb.createFont();
        titleFont.setFontName("Arial");
        titleFont.setFontHeightInPoints((short) 16);
        titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
        style.setFont(titleFont);
        styles.put("title", style);

        style = wb.createCellStyle();
        style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
        style.setBorderRight(CellStyle.BORDER_THIN);
        style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
        style.setBorderLeft(CellStyle.BORDER_THIN);
        style.setLeftBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
        style.setBorderTop(CellStyle.BORDER_THIN);
        style.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
        style.setBorderBottom(CellStyle.BORDER_THIN);
        style.setBottomBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
        Font dataFont = wb.createFont();
        dataFont.setFontName("Arial");
        dataFont.setFontHeightInPoints((short) 10);
        style.setFont(dataFont);
        styles.put("data", style);

        style = wb.createCellStyle();
        style.cloneStyleFrom(styles.get("data"));
        style.setAlignment(CellStyle.ALIGN_LEFT);
        styles.put("data1", style);

        style = wb.createCellStyle();
        style.cloneStyleFrom(styles.get("data"));
        style.setAlignment(CellStyle.ALIGN_CENTER);
        styles.put("data2", style);

        style = wb.createCellStyle();
        style.cloneStyleFrom(styles.get("data"));
        style.setAlignment(CellStyle.ALIGN_RIGHT);
        styles.put("data3", style);

        style = wb.createCellStyle();
        style.cloneStyleFrom(styles.get("data"));
//      style.setWrapText(true);
        style.setAlignment(CellStyle.ALIGN_CENTER);
        style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
        style.setFillPattern(CellStyle.SOLID_FOREGROUND);
        Font headerFont = wb.createFont();
        headerFont.setFontName("Arial");
        headerFont.setFontHeightInPoints((short) 10);
        headerFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
        headerFont.setColor(IndexedColors.WHITE.getIndex());
        style.setFont(headerFont);
        styles.put("header", style);

        return styles;
    }
项目:gw4e.project    文件:XLTest.java   
protected void formatCellStatus(Sheet sheet, Cell cell) {
    cell.setCellStyle(styles.get("status"));
    SheetConditionalFormatting sheetCF = sheet.getSheetConditionalFormatting();
    ConditionalFormattingRule ruleGreen = sheetCF.createConditionalFormattingRule(ComparisonOperator.EQUAL, "1");
    PatternFormatting fill1 = ruleGreen.createPatternFormatting();
    fill1.setFillBackgroundColor(IndexedColors.GREEN.index);
    fill1.setFillPattern(PatternFormatting.SOLID_FOREGROUND);
    //
    ConditionalFormattingRule ruleRed = sheetCF.createConditionalFormattingRule(ComparisonOperator.EQUAL, "0");
    PatternFormatting fill2 = ruleRed.createPatternFormatting();
    fill2.setFillBackgroundColor(IndexedColors.RED.index);
    fill2.setFillPattern(PatternFormatting.SOLID_FOREGROUND);
    //
    ConditionalFormattingRule ruleOrange = sheetCF.createConditionalFormattingRule(ComparisonOperator.EQUAL, "2");
    PatternFormatting fill3 = ruleOrange.createPatternFormatting();
    fill3.setFillBackgroundColor(IndexedColors.ORANGE.index);
    fill3.setFillPattern(PatternFormatting.SOLID_FOREGROUND);
    //
    String name = CellReference.convertNumToColString(cell.getColumnIndex());
    String location = "$" + name + "$" + cell.getRowIndex() + ":$" + name + "$" + (cell.getRowIndex() + 1);

    CellRangeAddress[] regions = { CellRangeAddress.valueOf(location) };
    ConditionalFormattingRule[] cfRules = new ConditionalFormattingRule[] { ruleGreen, ruleRed, ruleOrange };
    sheetCF.addConditionalFormatting(regions, cfRules);
}
项目:nbone    文件:AbstractPoiExcelTemplate.java   
/**
 * 
 * @return
 */
protected CellStyle crateCaptionCellStyle() {
    Font font = workbook.createFont();
    font.setColor(Font.COLOR_NORMAL);
    CellStyle cellStyle = workbook.createCellStyle();
    cellStyle.setWrapText(false);
    font.setFontHeight((short) 250);
    cellStyle.setFont(font);
    cellStyle.setFillForegroundColor(IndexedColors.BLUE_GREY.index);
    cellStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
    cellStyle.setAlignment(CellStyle.ALIGN_CENTER);
    return cellStyle;
}
项目:turnus    文件:PoiUtils.java   
/**
 * Set a bold font for the given cell with a given font size (in pt).
 * 
 * @param wb
 *            the workbook that contains the cell
 * @param cell
 *            the cell where the text is contained
 * @param size
 *            the size in pt of the text
 */
public static void setBold(Workbook wb, HSSFCell cell, short size) {
    Font font = wb.createFont();
    font.setFontHeightInPoints((short) size);
    font.setFontName("Arial");
    font.setColor(IndexedColors.BLACK.getIndex());
    font.setBold(true);
    font.setItalic(false);

    CellStyle style = wb.createCellStyle();
    style.setFont(font);
    cell.setCellStyle(style);
}
项目:turnus    文件:PoiUtils.java   
/**
 * Set a link to a cell. The link type should one of {@link Hyperlink}
 * 
 * @param wb
 *            the workbook which contains the cell
 * @param cell
 *            the cell where the link is stored
 * @param address
 *            the cell destination address
 * @param linkType
 *            the type selected among {@link Hyperlink}
 */
public static void setLink(Workbook wb, HSSFCell cell, String address, int linkType) {
    CreationHelper helper = wb.getCreationHelper();
    CellStyle style = wb.createCellStyle();
    Font font = wb.createFont();
    font.setUnderline(Font.U_SINGLE);
    font.setColor(IndexedColors.BLUE.getIndex());
    style.setFont(font);

    Hyperlink link = helper.createHyperlink(linkType);
    link.setAddress(address);
    cell.setHyperlink(link);
    cell.setCellStyle(style);
}
项目:bingexcel    文件:MyTest.java   
@Test
public void test2() throws IOException{
     Workbook wb = new HSSFWorkbook();
        Sheet sheet = wb.createSheet("new sheet");

        // Create a row and put some cells in it. Rows are 0 based.
        Row row = sheet.createRow(1);

        // Create a cell and put a value in it.


        // Style the cell with borders all around.
        CellStyle style = wb.createCellStyle();

        //     style.setFillBackgroundColor(IndexedColors.AUTOMATIC.getIndex());
       style.setFillPattern(CellStyle.SOLID_FOREGROUND);
       style.setFillForegroundColor(IndexedColors.LIGHT_ORANGE.index);

        Font font = wb.createFont();
        font.setFontHeightInPoints((short)24);
        font.setFontName("Courier New");
        font.setItalic(true);
        font.setStrikeout(true);
        style.setFont(font);
        CellUtil.createCell(row, 1, "nihao",style);
        //style.setFont(font);
        // Write the output to a file
        FileOutputStream fileOut = new FileOutputStream("workbook.xls");
        wb.write(fileOut);
        fileOut.close();
}
项目:ATTIC-osit    文件:ISheetTemplate.java   
/**
 * @param color
 * @param font
 * @return CellStyle
 */
protected XSSFCellStyle getCellStyle(XSSFColor color, Font font) {
    XSSFCellStyle style = wb.createCellStyle();
    style.setFillForegroundColor(color);
    style.setFillPattern(CellStyle.SOLID_FOREGROUND);
    style.setAlignment(CellStyle.ALIGN_CENTER);
    style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
    style.setWrapText(true);    // new line

    style.setBorderBottom(CellStyle.BORDER_THIN);
    style.setBottomBorderColor(IndexedColors.BLACK.getIndex());
    style.setBorderLeft(CellStyle.BORDER_THIN);
    style.setLeftBorderColor(IndexedColors.BLACK.getIndex());
    style.setBorderRight(CellStyle.BORDER_THIN);
    style.setRightBorderColor(IndexedColors.BLACK.getIndex());
    style.setBorderTop(CellStyle.BORDER_THIN);
    style.setTopBorderColor(IndexedColors.BLACK.getIndex());

    if(font != null) style.setFont(font);

    return style;
}
项目:Introspect-Framework    文件:ExcelWriter.java   
private CellStyle createTitleBarStyle(Workbook wb) {
    CellStyle style = wb.createCellStyle();
    style.setAlignment(CellStyle.ALIGN_CENTER);
    style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
    style.setFillForegroundColor(IndexedColors.GREY_40_PERCENT.getIndex());
    style.setFillPattern(CellStyle.SOLID_FOREGROUND);
    Font font = wb.createFont();
    font.setBoldweight(Font.BOLDWEIGHT_BOLD);
    font.setFontHeight((short) (font.getFontHeight() * 1.5));
    style.setFont(font);
    return style;
}
项目:Introspect-Framework    文件:ExcelWriter.java   
protected CellStyle createColumnHeaderStyle(Workbook wb) {
    CellStyle style = wb.createCellStyle();
    style.setAlignment(CellStyle.ALIGN_CENTER);
    style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
    style.setFillPattern(CellStyle.SOLID_FOREGROUND);
    Font font = wb.createFont();
    font.setBoldweight(Font.BOLDWEIGHT_BOLD);
    style.setFont(font);
    style.setBorderTop(CellStyle.BORDER_THIN);
    style.setBorderRight(CellStyle.BORDER_THIN);
    style.setBorderBottom(CellStyle.BORDER_THIN);
    style.setBorderLeft(CellStyle.BORDER_THIN);
    return style;
}
项目:sep4j    文件:Ssio.java   
private static Row createHeaders(Map<String, String> headerMap,
        Sheet sheet) {
    CellStyle style = sheet.getWorkbook().createCellStyle();
    style.setFillForegroundColor(IndexedColors.YELLOW.getIndex());
    style.setFillPattern(CellStyle.SOLID_FOREGROUND);
    style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
    style.setBorderTop(HSSFCellStyle.BORDER_THIN);
    style.setBorderRight(HSSFCellStyle.BORDER_THIN);
    style.setBorderLeft(HSSFCellStyle.BORDER_THIN);

    Row header = sheet.createRow(0);
    int columnIndex = 0;
    for (Map.Entry<String, String> entry : headerMap.entrySet()) {
        String headerText = StringUtils.defaultString(entry.getValue());
        Cell cell = createCell(header, columnIndex);
        cell.setCellValue(headerText);
        cell.setCellStyle(style);
        sheet.autoSizeColumn(columnIndex);
        columnIndex++;
    }

    return header;
}
项目:sakai    文件:SpreadsheetExporter.java   
private CellStyle createHeaderStyle(){
    //TO-DO read style information from sakai.properties
    Font font = gradesWorkbook.createFont();
    font.setFontName(HSSFFont.FONT_ARIAL);
    font.setColor(IndexedColors.PLUM.getIndex());
    font.setBold(true);
    CellStyle cellStyle = gradesWorkbook.createCellStyle();
    cellStyle.setFont(font);
    return cellStyle;
}
项目:tmxeditor8    文件:Excel2007Writer.java   
private int addLangCell(Row header, TmxSegement segment) {
    int CellNum = header.getLastCellNum();
    if (-1 == CellNum) {
        CellNum = 0;
    }
    Cell createCell = header.createCell(CellNum);
    CellStyle cellStyle = wb.createCellStyle();
    XSSFFont headerFont = (XSSFFont) wb.createFont();
    headerFont.setBold(true);
    cellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
    cellStyle.setFillPattern(XSSFCellStyle.SOLID_FOREGROUND);
    cellStyle.setFont(headerFont);
    createCell.setCellValue(segment.getLangCode());
    createCell.setCellStyle(cellStyle);
    sh.setColumnWidth(CellNum, (100 * 7 + 5) / 7 * 256);
    return CellNum;
}
项目:xlsmapper    文件:AnnoFormulaTest.java   
@XlsPostSave
public void handlePostSave(final Sheet sheet) {

    if(!name.equals("平均")) {
        return;
    }

    final Workbook book = sheet.getWorkbook();

    for(Point address : positions.values()) {
        Cell cell = POIUtils.getCell(sheet, address);

        CellStyle style = book.createCellStyle();
        style.cloneStyleFrom(cell.getCellStyle());

        // 塗りつぶし
        style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
        style.setFillPattern(CellStyle.SOLID_FOREGROUND);

        // 罫線の上部を変更
        style.setBorderTop(CellStyle.BORDER_DOUBLE);

        cell.setCellStyle(style);
    }

}
项目:eoulsan    文件:XLSXTranslatorOutputFormat.java   
/**
 * Public constructor.
 * @param os output stream
 */
public XLSXTranslatorOutputFormat(final OutputStream os) {

  if (os == null) {
    throw new NullPointerException("The output stream is null");
  }

  this.os = os;

  // Temporary files will be compressed
  this.wb.setCompressTempFiles(true);

  // Define default style
  Font defaultFont = this.wb.createFont();
  defaultFont.setFontName("Arial");
  defaultFont.setFontHeightInPoints((short) 10);
  this.defaultStyle = this.wb.createCellStyle();
  this.defaultStyle.setFont(defaultFont);

  // Define header style
  Font headerFont = this.wb.createFont();
  headerFont.setFontName(defaultFont.getFontName());
  headerFont.setFontHeightInPoints(defaultFont.getFontHeightInPoints());
  headerFont.setItalic(true);
  this.headerStyle = this.wb.createCellStyle();
  this.headerStyle.setFillForegroundColor(IndexedColors.ORANGE.getIndex());
  this.headerStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
  this.headerStyle.setFont(headerFont);

  // Define link style
  Font linkfont = this.wb.createFont();
  linkfont.setFontName(defaultFont.getFontName());
  linkfont.setFontHeightInPoints(defaultFont.getFontHeightInPoints());
  linkfont.setUnderline(XSSFFont.U_SINGLE);
  linkfont.setColor(IndexedColors.BLUE.getIndex());
  this.linkStyle = this.wb.createCellStyle();
  this.linkStyle.setFont(linkfont);
}
项目:excel2canvas    文件:ExcelUtils.java   
/**
 * CellStyleに何も情報が設定されていない場合にtrueを返す
 */
public static boolean isNoneStyle(CellStyle style) {
    if (style == null) return true;

    if (style.getDataFormat() != 0) return false;
    if (style.getFillPattern() != CellStyle.NO_FILL) return false;
    if (style.getFillBackgroundColor() != IndexedColors.AUTOMATIC.getIndex()) return false;
    if (style.getFillForegroundColor() != IndexedColors.AUTOMATIC.getIndex()) return false;
    if (style.getFontIndex() != 0) return false;
    if (style.getIndention() != 0) return false;
    if (style.getRotation() != 0) return false;
    if (style.getAlignment() != CellStyle.ALIGN_GENERAL) return false;
    if (style.getVerticalAlignment() != CellStyle.VERTICAL_CENTER) return false;
    if (style.getBorderTop() != CellStyle.BORDER_NONE) return false;
    if (style.getBorderLeft() != CellStyle.BORDER_NONE) return false;
    if (style.getBorderRight() != CellStyle.BORDER_NONE) return false;
    if (style.getBorderBottom() != CellStyle.BORDER_NONE) return false;
    if (style.getWrapText()) return false;
    if (style.getHidden()) return false;
    if (!style.getLocked()) return false;

    return true;
}
项目:excel2canvas    文件:ExcelUtils.java   
public static CellStyle createDefaultLabelStyle(Workbook workbook) {
    CellStyle style = workbook.createCellStyle();
    Font font = workbook.createFont();
    font.setBoldweight(Font.BOLDWEIGHT_BOLD);
    font.setFontHeightInPoints((short)12);
    style.setFont(font);
    style.setBorderBottom(CellStyle.BORDER_DOUBLE);
    style.setFillPattern(CellStyle.SOLID_FOREGROUND);
    style.setFillForegroundColor(IndexedColors.AQUA.getIndex());
    return style;
}
项目:aem-epic-tool    文件:ReportUtil.java   
public static CellStyle createHeaderStyle(Workbook workbook) {
    XSSFCellStyle headerStyle = createCellStyle(workbook);
    XSSFColor header = new XSSFColor(new byte[]{(byte) 79, (byte) 129, (byte) 189});
    headerStyle.setFillForegroundColor(header);
    headerStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    headerStyle.getFont().setColor(IndexedColors.WHITE.index);
    return headerStyle;
}
项目:lams    文件:AssessmentServiceImpl.java   
private ExcelCell[] outputSummaryTable(AssessmentQuestion question, Map<Long, Integer> summaryOfAnswers,
    Integer summaryNACount, Long trueKey, Long falseKey) {
ExcelCell[] summaryTable = new ExcelCell[summaryOfAnswers.size()+1];
int total = summaryNACount;
for ( int value : summaryOfAnswers.values() ) {
total += value;
}
int i = 0;
if (question.getType() == AssessmentConstants.QUESTION_TYPE_MULTIPLE_CHOICE
    || question.getType() == AssessmentConstants.QUESTION_TYPE_SHORT_ANSWER
    || question.getType() == AssessmentConstants.QUESTION_TYPE_NUMERICAL ) {
for (AssessmentQuestionOption option : question.getOptions()) {
    summaryTable[i] = new ExcelCell(valueAsPercentage(summaryOfAnswers.get(option.getUid()), total), false);
    if ( option.getGrade() > 0 ) {
    summaryTable[i].setColor(IndexedColors.GREEN);
    }
    i++;
}
summaryTable[i++] = new ExcelCell(valueAsPercentage(summaryNACount, total), false);
} else {
summaryTable = new ExcelCell[3];
summaryTable[0] = new ExcelCell(valueAsPercentage(summaryOfAnswers.get(trueKey), total), false);
summaryTable[1] = new ExcelCell(valueAsPercentage(summaryOfAnswers.get(falseKey), total), false);
summaryTable[2] = new ExcelCell(valueAsPercentage(summaryNACount,total), false);
summaryTable[question.getCorrectAnswer() ? 0 : 1].setColor(IndexedColors.GREEN);
}
return summaryTable;
   }
项目:spring-i18n-support    文件:ExcelWriter.java   
/**
 * Creates an excel sheet in the provided workbook using provided parameters.
 * 
 * @param input the data to put in the sheet-
 * @param sheetName the name to user for the sheet.
 * @param wb the workbook to create the sheet in.
 */
private void createSheet(   List<MessageResourceEntry> input,
                            String sheetName,
                            Workbook wb)
{
    // create a new sheet
    String name = StringUtils.isBlank(sheetName) ? this.defaultSheetName : sheetName;
    LOG.info("Create sheet with name " + name);
    Sheet sheet = wb.createSheet(name);
    sheet.setZoom(this.zoom, 100);

    Map<Locale, Integer> langs = getLanguageInformation(input);
    createHeader(sheet, langs);

    CellStyle keyStyle = sheet.getWorkbook().createCellStyle();
    keyStyle.setAlignment(CellStyle.ALIGN_LEFT);
    keyStyle.setBorderBottom(CellStyle.BORDER_THIN);
    keyStyle.setBorderRight(CellStyle.BORDER_MEDIUM);
    Font f = sheet.getWorkbook().createFont();
    f.setBoldweight(Font.BOLDWEIGHT_NORMAL);
    keyStyle.setFont(f);

    CellStyle valueStyle = sheet.getWorkbook().createCellStyle();
    valueStyle.setAlignment(CellStyle.ALIGN_LEFT);
    valueStyle.setVerticalAlignment(CellStyle.VERTICAL_TOP);
    valueStyle.setBorderBottom(CellStyle.BORDER_THIN);
    valueStyle.setBorderRight(CellStyle.BORDER_THIN);
    valueStyle.setBorderTop(CellStyle.BORDER_THIN);
    valueStyle.setBorderLeft(CellStyle.BORDER_THIN);
    valueStyle.setFont(f);
    valueStyle.setWrapText(true);

    CellStyle emptyStyle = sheet.getWorkbook().createCellStyle();
    emptyStyle.setAlignment(CellStyle.ALIGN_LEFT);
    emptyStyle.setVerticalAlignment(CellStyle.VERTICAL_TOP);
    emptyStyle.setBorderBottom(CellStyle.BORDER_THIN);
    emptyStyle.setBorderRight(CellStyle.BORDER_THIN);
    emptyStyle.setBorderTop(CellStyle.BORDER_THIN);
    emptyStyle.setBorderLeft(CellStyle.BORDER_THIN);
    emptyStyle.setFont(f);
    emptyStyle.setFillForegroundColor(IndexedColors.LAVENDER.getIndex());
    emptyStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
    emptyStyle.setWrapText(true);

    LOG.info("Write data to sheet " + name);
    int rowIndex = this.languageHeaderRow + 1;
    for (MessageResourceEntry entry : input)
    {
        Row row = sheet.createRow(rowIndex);
        createContentRow(entry, row, langs, keyStyle, valueStyle, emptyStyle);
        rowIndex++;
    }
    sizeColumns(sheet, langs);
    sheet.createFreezePane(this.firstLanguageColumn, this.languageHeaderRow + 1, this.firstLanguageColumn, this.languageHeaderRow + 1);
}
项目:ramus    文件:Exporter.java   
private static CellStyle createBorderedStyle(Workbook wb) {
    CellStyle style = wb.createCellStyle();
    style.setBorderRight(CellStyle.BORDER_THIN);
    style.setRightBorderColor(IndexedColors.BLACK.getIndex());
    style.setBorderBottom(CellStyle.BORDER_THIN);
    style.setBottomBorderColor(IndexedColors.BLACK.getIndex());
    style.setBorderLeft(CellStyle.BORDER_THIN);
    style.setLeftBorderColor(IndexedColors.BLACK.getIndex());
    style.setBorderTop(CellStyle.BORDER_THIN);
    style.setTopBorderColor(IndexedColors.BLACK.getIndex());
    return style;
}
项目:exportExcel    文件:ExcelTest.java   
/**
 * excel 样式
 *
 * @return
 */
public Map<String, CellStyle> createStyles(Workbook workbook) {
    Map<String, CellStyle> styles = new HashMap();
    CellStyle style = workbook.createCellStyle();
    style.setAlignment((short) 2);
    style.setVerticalAlignment((short) 1);
    Font titleFont = workbook.createFont();
    titleFont.setFontName("Arial");
    titleFont.setFontHeightInPoints((short) 16);
    titleFont.setBoldweight((short) 700);
    style.setFont(titleFont);
    styles.put("title", style);
    style = workbook.createCellStyle();
    style.setVerticalAlignment((short) 1);
    style.setBorderRight((short) 1);
    style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
    style.setBorderLeft((short) 1);
    style.setLeftBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
    style.setBorderTop((short) 1);
    style.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
    style.setBorderBottom((short) 1);
    style.setBottomBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
    Font dataFont = workbook.createFont();
    dataFont.setFontName("Arial");
    dataFont.setFontHeightInPoints((short) 10);
    style.setFont(dataFont);
    styles.put("data", style);
    style = workbook.createCellStyle();
    style.cloneStyleFrom((CellStyle) styles.get("data"));
    style.setAlignment((short) 1);
    styles.put("data1", style);
    style = workbook.createCellStyle();
    style.cloneStyleFrom((CellStyle) styles.get("data"));
    style.setAlignment((short) 2);
    styles.put("data2", style);
    style = workbook.createCellStyle();
    style.cloneStyleFrom((CellStyle) styles.get("data"));
    style.setAlignment((short) 3);
    styles.put("data3", style);
    style = workbook.createCellStyle();
    style.cloneStyleFrom((CellStyle) styles.get("data"));
    style.setAlignment((short) 2);
    style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
    style.setFillPattern((short) 1);
    Font headerFont = workbook.createFont();
    headerFont.setFontName("Arial");
    headerFont.setFontHeightInPoints((short) 10);
    headerFont.setBoldweight((short) 700);
    headerFont.setColor(IndexedColors.WHITE.getIndex());
    style.setFont(headerFont);
    styles.put("header", style);
    return styles;
}
项目:vaadin-gridexport    文件:ExcelExport.java   
/**
 * Returns the default totals row style for Double data. Obtained from:
 * http://svn.apache.org/repos/asf/poi
 * /trunk/src/examples/src/org/apache/poi/ss/examples/TimesheetDemo.java
 *
 * @param wb the wb
 * @return the cell style
 */
protected CellStyle defaultTotalsDoubleCellStyle(final Workbook wb) {
    CellStyle style;
    style = wb.createCellStyle();
    style.setAlignment(HorizontalAlignment.CENTER);
    style.setVerticalAlignment(VerticalAlignment.CENTER);
    style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
    style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    style.setDataFormat(doubleDataFormat);
    return style;
}
项目:vaadin-gridexport    文件:ExcelExport.java   
/**
 * Returns the default totals row style for Integer data. Obtained from:
 * http://svn.apache.org/repos/asf/poi
 * /trunk/src/examples/src/org/apache/poi/ss/examples/TimesheetDemo.java
 *
 * @param wb the wb
 * @return the cell style
 */
protected CellStyle defaultTotalsIntegerCellStyle(final Workbook wb) {
    CellStyle style;
    style = wb.createCellStyle();
    style.setAlignment(HorizontalAlignment.CENTER);
    style.setVerticalAlignment(VerticalAlignment.CENTER);
    style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
    style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    style.setDataFormat(integerDataFormat);
    return style;
}
项目:hy.common.report    文件:ColorListener.java   
/**
 * 对变量名称反射出来的值进行加工处理
 * 
 * @author      ZhengWei(HY)
 * @createDate  2017-06-29
 * @version     v1.0
 *
 * @param i_RTemplate     模板
 * @param i_TemplateCell  模板单元格对象
 * @param i_DataCell      数据单元格对象
 * @param i_DataWorkbook  数据工作薄对象
 * @param i_RSystemValue  系统变量信息
 * @param i_Datas         本行对应的数据
 * @param i_Value         反射出来的变量名称对应的值
 * @return 
 */
public String getValue(RTemplate i_RTemplate ,Cell i_TemplateCell ,Cell i_DataCell ,RWorkbook i_DataWorkbook ,RSystemValue i_RSystemValue ,Object i_Datas ,Object i_Value)
{
    CellStyle v_NewCellStyle = null;

    if ( i_DataCell.getRow().getRowNum() % 2 == 1 )
    {
        v_NewCellStyle = i_DataWorkbook.getCellStyleByCopy("单行" ,i_DataCell ,i_RTemplate);
        v_NewCellStyle.setFillForegroundColor(IndexedColors.ORANGE.index);
    }
    else
    {
        v_NewCellStyle = i_DataWorkbook.getCellStyleByCopy("双行" ,i_DataCell ,i_RTemplate);
        v_NewCellStyle.setFillForegroundColor(IndexedColors.RED.index);
    }

    v_NewCellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);

    i_DataCell.setCellStyle(v_NewCellStyle);

    if ( i_Value == null )
    {
        return "";
    }

    return i_Value.toString();
}
项目:bdf2    文件:AbstractStyleBuilder.java   
public CellStyle createBorderCellStyle(Workbook workbook, boolean showBorder) {
    CellStyle style = workbook.createCellStyle();
    if (showBorder) {
        style.setBorderRight(BorderStyle.THIN);
        style.setRightBorderColor(IndexedColors.BLACK.getIndex());
        style.setBorderBottom(BorderStyle.THIN);
        style.setBottomBorderColor(IndexedColors.BLACK.getIndex());
        style.setBorderLeft(BorderStyle.THIN);
        style.setLeftBorderColor(IndexedColors.BLACK.getIndex());
        style.setBorderTop(BorderStyle.THIN);
        style.setTopBorderColor(IndexedColors.BLACK.getIndex());
    }
    return style;
}
项目:gedantic    文件:WorkbookCreator.java   
/**
 * Setup styles.
 */
private void setupStyles() {
    styleTitle = wb.createCellStyle();
    Font title_font = wb.createFont();
    title_font.setFontName("Helvetica");
    title_font.setColor(IndexedColors.BLACK.getIndex());
    title_font.setFontHeightInPoints((short) 24);
    styleTitle.setFont(title_font);

    styleSubtitle = wb.createCellStyle();
    Font subtitle_font = wb.createFont();
    subtitle_font.setFontName("Helvetica");
    subtitle_font.setColor(IndexedColors.GREY_50_PERCENT.getIndex());
    subtitle_font.setFontHeightInPoints((short) 18);
    styleSubtitle.setFont(subtitle_font);

    styleHyperlink = wb.createCellStyle();
    Font hlink_font = wb.createFont();
    hlink_font.setFontName("Helvetica");
    hlink_font.setUnderline(Font.U_SINGLE);
    hlink_font.setColor(IndexedColors.BLUE.getIndex());
    styleHyperlink.setFont(hlink_font);

    styleNormal = wb.createCellStyle();
    Font normal_font = wb.createFont();
    normal_font.setFontName("Helvetica");
    normal_font.setColor(IndexedColors.BLACK.getIndex());
    normal_font.setFontHeightInPoints((short) 12);
    styleNormal.setFont(normal_font);
    styleNormal.setWrapText(true);

    styleHeader = wb.createCellStyle();
    Font header_font = wb.createFont();
    header_font.setFontName("Helvetica");
    header_font.setColor(IndexedColors.WHITE.getIndex());
    header_font.setBold(true);
    header_font.setFontHeightInPoints((short) 12);
    XSSFColor bg = new XSSFColor(new java.awt.Color(0x28, 0x60, 0x90));
    ((XSSFCellStyle) styleHeader).setFillForegroundColor(bg);
    styleHeader.setFillPattern(CellStyle.SOLID_FOREGROUND);
    styleHeader.setFont(header_font);

}
项目:DAtools    文件:CoverageForExomeSeq.java   
public void writeOutList(ArrayList<CoverageOutClass> colist) throws FileNotFoundException, IOException {
    Workbook wb = new XSSFWorkbook();
    Sheet sheet1 = wb.createSheet("CoverageSummary");

    CellStyle style = wb.createCellStyle();
    style.setFillForegroundColor(IndexedColors.ORANGE.getIndex());
    style.setFillPattern(CellStyle.SOLID_FOREGROUND);

    int rowIndex;
    Row row = sheet1.createRow(0);
    row.createCell(0).setCellValue("Samplename");
    row.createCell(1).setCellValue("TotalTargetBases");
    row.createCell(2).setCellValue("Sequenced Bases");
    row.createCell(3).setCellValue("Sequenced Rate");
    row.createCell(4).setCellValue("AverageCoverage");
    row.createCell(5).setCellValue("Depth > 5");
    row.createCell(6).setCellValue("Depth > 10");
    row.createCell(7).setCellValue("Depth > 20");
    row.createCell(8).setCellValue("Depth > 30");
    row.createCell(9).setCellValue("Depth > 50");
    for (rowIndex = 0; rowIndex < colist.size(); rowIndex++) {
        row = sheet1.createRow(rowIndex + 1);
        row.createCell(0).setCellValue(colist.get(rowIndex).getSample());
        row.createCell(1).setCellValue(colist.get(rowIndex).getTargetbase());
        row.createCell(2).setCellValue(colist.get(rowIndex).getSeqedBase());
        row.createCell(3).setCellValue(colist.get(rowIndex).getSeqRate());
        row.createCell(4).setCellValue(colist.get(rowIndex).getAverageCov());
        row.createCell(5).setCellValue(colist.get(rowIndex).getOver5Rate());
        row.createCell(6).setCellValue(colist.get(rowIndex).getOver10Rate());
        row.createCell(7).setCellValue(colist.get(rowIndex).getOver20Rate());
        row.createCell(8).setCellValue(colist.get(rowIndex).getOver30Rate());
        row.createCell(9).setCellValue(colist.get(rowIndex).getOver50Rate());
    }

    FileOutputStream fileOut = new FileOutputStream(outfile + ".xlsx");
    wb.write(fileOut);
    fileOut.close();
    System.out.println("Convert finished. The output file is named as " + outfile + ".xlsx");
}
项目:Shop-for-JavaWeb    文件:ExportExcel.java   
/**
     * 创建表格样式
     * @param wb 工作薄对象
     * @return 样式列表
     */
    private Map<String, CellStyle> createStyles(Workbook wb) {
        Map<String, CellStyle> styles = new HashMap<String, CellStyle>();

        CellStyle style = wb.createCellStyle();
        style.setAlignment(CellStyle.ALIGN_CENTER);
        style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
        Font titleFont = wb.createFont();
        titleFont.setFontName("Arial");
        titleFont.setFontHeightInPoints((short) 16);
        titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
        style.setFont(titleFont);
        styles.put("title", style);

        style = wb.createCellStyle();
        style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
        style.setBorderRight(CellStyle.BORDER_THIN);
        style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
        style.setBorderLeft(CellStyle.BORDER_THIN);
        style.setLeftBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
        style.setBorderTop(CellStyle.BORDER_THIN);
        style.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
        style.setBorderBottom(CellStyle.BORDER_THIN);
        style.setBottomBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
        Font dataFont = wb.createFont();
        dataFont.setFontName("Arial");
        dataFont.setFontHeightInPoints((short) 10);
        style.setFont(dataFont);
        styles.put("data", style);

        style = wb.createCellStyle();
        style.cloneStyleFrom(styles.get("data"));
        style.setAlignment(CellStyle.ALIGN_LEFT);
        styles.put("data1", style);

        style = wb.createCellStyle();
        style.cloneStyleFrom(styles.get("data"));
        style.setAlignment(CellStyle.ALIGN_CENTER);
        styles.put("data2", style);

        style = wb.createCellStyle();
        style.cloneStyleFrom(styles.get("data"));
        style.setAlignment(CellStyle.ALIGN_RIGHT);
        styles.put("data3", style);

        style = wb.createCellStyle();
        style.cloneStyleFrom(styles.get("data"));
//      style.setWrapText(true);
        style.setAlignment(CellStyle.ALIGN_CENTER);
        style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
        style.setFillPattern(CellStyle.SOLID_FOREGROUND);
        Font headerFont = wb.createFont();
        headerFont.setFontName("Arial");
        headerFont.setFontHeightInPoints((short) 10);
        headerFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
        headerFont.setColor(IndexedColors.WHITE.getIndex());
        style.setFont(headerFont);
        styles.put("header", style);

        return styles;
    }
项目:kdxplore    文件:CellStyleProvider.java   
public CellStyle getCellStyle(BmsCellColor bmsCellColor) {

    CellStyle result = styleByBmsCellColor.get(bmsCellColor);

    if (result == null) {

        result = workbook.createCellStyle();

        result.setFillPattern(CellStyle.SOLID_FOREGROUND);
        result.setFillForegroundColor(bmsCellColor.indexedColor.getIndex());

        Font font = workbook.createFont();
        font.setColor(IndexedColors.WHITE.getIndex());
        result.setFont(font);

        styleByBmsCellColor.put(bmsCellColor, result);
    }

    return result;
}
项目:TranskribusCore    文件:TrpXlsxBuilder.java   
private static void ExcelTest(String Path) {
    Workbook wb = new XSSFWorkbook();
    Sheet employees = wb.createSheet(WorkbookUtil.createSafeSheetName("Mitarbeiter"));

    wb.getNumberOfSheets();
    wb.getSheet("test").getLastRowNum();

    Sheet s2 = wb.createSheet(WorkbookUtil.createSafeSheetName("Schorsch"));

    CreationHelper crHelper = wb.getCreationHelper();
    Row firstRow = employees.createRow(0);
    firstRow.createCell(0).setCellValue(crHelper.createRichTextString("Vorname"));
    firstRow.createCell(1).setCellValue(crHelper.createRichTextString("Nachname"));
    firstRow.createCell(2).setCellValue(crHelper.createRichTextString("Geburtsdatum"));

    Row secondRow = employees.createRow(1);
    secondRow.createCell(0).setCellValue(crHelper.createRichTextString("Santa"));
    secondRow.createCell(1).setCellValue(crHelper.createRichTextString("Claus"));
    secondRow.createCell(2).setCellValue(crHelper.createDataFormat().getFormat("1823-12-23"));

    Row thirdRow = employees.createRow(2);
    thirdRow.createCell(0).setCellValue(crHelper.createRichTextString("Oster"));
    thirdRow.createCell(1).setCellValue(crHelper.createRichTextString("Hase"));
    thirdRow.createCell(2).setCellValue(crHelper.createDataFormat().getFormat("1682-01-01"));

    CellStyle formatTableHead = wb.createCellStyle();
    formatTableHead.setFillForegroundColor(IndexedColors.BLUE_GREY.getIndex());
    formatTableHead.setFillPattern(CellStyle.SOLID_FOREGROUND);

    Font fontTableHead = wb.createFont();
    fontTableHead.setColor(IndexedColors.WHITE.getIndex());
    formatTableHead.setFont(fontTableHead);

    firstRow.getCell(0).setCellStyle(formatTableHead);
    firstRow.getCell(1).setCellStyle(formatTableHead);
    firstRow.getCell(2).setCellStyle(formatTableHead);

    CellStyle formatGebDate  = wb.createCellStyle();
    formatGebDate.setDataFormat(crHelper.createDataFormat().getFormat("dd.mm.yy"));

    secondRow.getCell(2).setCellStyle(formatGebDate);
    thirdRow.getCell(2).setCellStyle(formatGebDate);

    employees.autoSizeColumn(0);
    employees.autoSizeColumn(1);
    employees.autoSizeColumn(2);

    FileOutputStream fOut;
    try {
        fOut = new FileOutputStream(Path);
        wb.write(fOut);
        fOut.close();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

}
项目:mpp-viewer    文件:ExcelOutput.java   
@Override
protected Void doInBackground() throws Exception {
    wb = new XSSFWorkbook();
    sheet = wb.createSheet("Project Plan");
    createHelper = wb.getCreationHelper();
    CellStyle style = wb.createCellStyle();
    style.setFillForegroundColor(IndexedColors.DARK_TEAL.getIndex());
    style.setFillPattern(CellStyle.SOLID_FOREGROUND);
    Font font = wb.createFont();
    font.setColor(IndexedColors.WHITE.getIndex());
    style.setFont(font);
    Row row=sheet.createRow(rowIndex++);
    Cell cell = row.createCell(0);
    cell.setCellValue("ID");
    cell.setCellStyle(style);
    cell = row.createCell(1);
    cell.setCellValue("Task Name");
    cell.setCellStyle(style);
    cell = row.createCell(2);
    cell.setCellValue("Duration");
    cell.setCellStyle(style);
    cell = row.createCell(3);
    cell.setCellValue("Start");
    cell.setCellStyle(style);
    cell = row.createCell(4);
    cell.setCellValue("Finish");
    cell.setCellStyle(style);
    cell = row.createCell(5);
    cell.setCellValue("% Complete");
    cell.setCellStyle(style);
    cell = row.createCell(6);
    cell.setCellValue("Predecessor");
    cell.setCellStyle(style);
    cell = row.createCell(7);
    cell.setCellValue("Resources");
    cell.setCellStyle(style);

    sheet.setColumnWidth(1, 50 * 256);

    setProgress(10);
    listHierarchy(projectFile);
    setProgress(60);

    sheet.setColumnWidth(1, maxTaskNameLength*250);
    sheet.setColumnWidth(3, 17*250);
    sheet.setColumnWidth(4, 17*250);

    writeToFile(outputFile);
    setProgress(100);
    return null;
}
项目:kunter-generator    文件:MakeDatabaseOfExcel.java   
/**
 * 蓝色背景样式
 *
 * @param workbook
 * @return
 * @author 阳自然
 */
private static CellStyle getCellStyleBlue(Workbook workbook) {

    CellStyle cellStyle = getCellStyle(workbook);

    // 设置单元格颜色
    cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    cellStyle.setFillForegroundColor(IndexedColors.CORNFLOWER_BLUE.getIndex());

    return cellStyle;
}
项目:ATTIC-osit    文件:CoverSheetTemplate.java   
protected void createTitle() {
    short lineThickness = (short) (6 * BASE_HEIGHT);

    // Top Line
    Row row = sheet.createRow(ROW_4);
    row.setHeight(lineThickness);

    XSSFCellStyle style = wb.createCellStyle();
    style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
    style.setFillPattern(CellStyle.SOLID_FOREGROUND);
    setDummyTitleStyle(row,style);

    // Title
    row = sheet.createRow(ROW_5);
    row.setHeightInPoints(100);
    sheet.addMergedRegion(CellRangeAddress.valueOf("B5:G5"));

    Font font = wb.createFont();
    font.setFontHeightInPoints((short)28);
    font.setFontName("Trebuchet MS");
    font.setBoldweight(Font.BOLDWEIGHT_BOLD);
    style = wb.createCellStyle();
    style.setFont(font);
    style.setAlignment(CellStyle.ALIGN_CENTER);
    style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);

    setDummyTitleStyle(row,style);
    row.getCell(COL_B).setCellValue("Open Source License Verification Report");

    // Bottom Line
    row = sheet.createRow(ROW_6);
    row.setHeight(lineThickness);

    style = wb.createCellStyle();
    style.setFillForegroundColor(DARK_BLUE);
    style.setFillPattern(CellStyle.SOLID_FOREGROUND);
    setDummyTitleStyle(row,style);
}
项目:ATTIC-osit    文件:CoverSheetTemplate.java   
protected XSSFCellStyle getCellStyle(int border, Font font) {
    XSSFCellStyle style = wb.createCellStyle();
    style.setAlignment(CellStyle.ALIGN_CENTER);
    style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
    style.setWrapText(true);    // new line

    style.setBottomBorderColor(IndexedColors.BLACK.getIndex());
    style.setLeftBorderColor(IndexedColors.BLACK.getIndex());
    style.setRightBorderColor(IndexedColors.BLACK.getIndex());
    style.setTopBorderColor(IndexedColors.BLACK.getIndex());

    if((border & BORDER_BOTTOM) > 0) style.setBorderBottom(CellStyle.BORDER_DOUBLE);
    else style.setBorderBottom(CellStyle.BORDER_THIN);

    if((border & BORDER_LEFT) > 0) style.setBorderLeft(CellStyle.BORDER_DOUBLE);
    else style.setBorderLeft(CellStyle.BORDER_THIN);

    if((border & BORDER_RIGHT) > 0) style.setBorderRight(CellStyle.BORDER_DOUBLE);
    else style.setBorderRight(CellStyle.BORDER_THIN);

    if((border & BORDER_TOP) > 0) style.setBorderTop(CellStyle.BORDER_DOUBLE);
    else style.setBorderTop(CellStyle.BORDER_THIN);

    if(font != null) style.setFont(font);

    return style;
}