Example usage for org.apache.poi.ss.usermodel CellStyle setFont

List of usage examples for org.apache.poi.ss.usermodel CellStyle setFont

Introduction

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

Prototype

void setFont(Font font);

Source Link

Document

set the font for this style

Usage

From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.ReviewerVendorPoXlsReportHelper.java

License:Apache License

private CellStyle getWrongJobStyle(Workbook p_workbook) throws Exception {
    if (wrongJobStyle == null) {
        Font wrongJobFont = p_workbook.createFont();
        wrongJobFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
        wrongJobFont.setColor(IndexedColors.GREY_50_PERCENT.getIndex());
        wrongJobFont.setUnderline(Font.U_NONE);
        wrongJobFont.setFontName("Times");
        wrongJobFont.setFontHeightInPoints((short) 11);

        CellStyle cs = p_workbook.createCellStyle();
        cs.setFont(wrongJobFont);

        wrongJobStyle = cs;/*  w ww  .j av a 2 s . c o m*/
    }

    return wrongJobStyle;
}

From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.ReviewerVendorPoXlsReportHelper.java

License:Apache License

private CellStyle getSubTotalStyle(Workbook p_workbook) throws Exception {
    if (subTotalStyle == null) {
        Font subTotalFont = p_workbook.createFont();
        subTotalFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
        subTotalFont.setColor(IndexedColors.BLACK.getIndex());
        subTotalFont.setUnderline(Font.U_NONE);
        subTotalFont.setFontName("Arial");
        subTotalFont.setFontHeightInPoints((short) 10);

        CellStyle cs = p_workbook.createCellStyle();
        cs.setFont(subTotalFont);
        cs.setWrapText(true);//w  w  w . ja  va  2s.  c  o  m
        cs.setBorderTop(CellStyle.BORDER_THIN);
        cs.setBorderBottom(CellStyle.BORDER_THIN);
        cs.setFillPattern(CellStyle.SOLID_FOREGROUND);
        cs.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());

        subTotalStyle = cs;
    }

    return subTotalStyle;
}

From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.SlaXlsReportHelper.java

License:Apache License

private void addTitle(Workbook p_workbook) throws Exception {
    Sheet theSheet = data.generalSheet;/*from  w  w  w.  j a  v a  2  s .c  o  m*/
    // title font is black bold on white
    Font titleFont = p_workbook.createFont();
    titleFont.setUnderline(Font.U_NONE);
    titleFont.setFontName("Arial");
    titleFont.setFontHeightInPoints((short) 14);
    titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
    titleFont.setColor(IndexedColors.BLACK.getIndex());
    CellStyle titleStyle = p_workbook.createCellStyle();
    titleStyle.setWrapText(false);
    titleStyle.setFont(titleFont);

    Cell titleCell = getCell(getRow(theSheet, 0), 0);
    titleCell.setCellValue(bundle.getString("translation_sla_performance"));
    titleCell.setCellStyle(titleStyle);
    theSheet.setColumnWidth(0, 20 * 256);
}

From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.SlaXlsReportHelper.java

License:Apache License

private CellStyle getHeaderStyle(Workbook p_workbook) throws Exception {
    if (headerStyle == null) {
        Font font = p_workbook.createFont();
        font.setBoldweight(Font.BOLDWEIGHT_BOLD);
        font.setColor(IndexedColors.BLACK.getIndex());
        font.setUnderline(Font.U_NONE);
        font.setFontName("Arial");
        font.setFontHeightInPoints((short) 9);

        CellStyle cs = p_workbook.createCellStyle();
        cs.setFont(font);
        cs.setWrapText(true);//from   w  w w  . ja v a 2s.  co  m
        cs.setFillPattern(CellStyle.SOLID_FOREGROUND);
        cs.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
        cs.setBorderTop(CellStyle.BORDER_THIN);
        cs.setBorderRight(CellStyle.BORDER_THIN);
        cs.setBorderBottom(CellStyle.BORDER_THIN);
        cs.setBorderLeft(CellStyle.BORDER_THIN);

        headerStyle = cs;
    }

    return headerStyle;
}

From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.SlaXlsReportHelper.java

License:Apache License

private CellStyle getContentRightStyle(Workbook p_workbook) throws Exception {
    if (contentRightStyle == null) {
        CellStyle style = p_workbook.createCellStyle();
        style.setWrapText(true);/*from   w  w w  .  j  a v a2 s  .  c o m*/
        style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
        Font font = p_workbook.createFont();
        font.setFontName("Arial");
        font.setFontHeightInPoints((short) 10);
        style.setFont(font);

        contentRightStyle = style;
    }

    return contentRightStyle;
}

From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.TranslationProgressReportHelper.java

License:Apache License

private void addTitle(Workbook p_workbook, Sheet p_sheet) throws Exception {
    // title font is black bold on white
    // String EMEA = CompanyWrapper.getCurrentCompanyName();
    Font titleFont = p_workbook.createFont();
    titleFont.setUnderline(Font.U_NONE);
    titleFont.setFontName("Times");
    titleFont.setFontHeightInPoints((short) 14);
    titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
    titleFont.setColor(IndexedColors.BLACK.getIndex());
    CellStyle titleStyle = p_workbook.createCellStyle();
    titleStyle.setWrapText(false);// w  w  w  .j  a v a  2 s .  c o  m
    titleStyle.setFont(titleFont);

    Row titleRow = getRow(p_sheet, 0);
    Cell cell_A_Title = getCell(titleRow, 0);
    cell_A_Title.setCellValue(bundle.getString("review_translation_progress_report"));
    cell_A_Title.setCellStyle(titleStyle);
    p_sheet.setColumnWidth(0, 22 * 256);
}

From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.TranslationProgressReportHelper.java

License:Apache License

private CellStyle getPercentStyle(Workbook p_workbook) throws Exception {
    if (percentStyle == null) {
        DataFormat format = p_workbook.createDataFormat();
        CellStyle style = p_workbook.createCellStyle();
        Font font = p_workbook.createFont();
        font.setFontName("Arial");
        font.setFontHeightInPoints((short) 10);
        style.setDataFormat(format.getFormat("0%"));
        style.setFont(font);
        style.setWrapText(true);//w ww. j a  v  a  2 s.co m
        style.setAlignment(CellStyle.ALIGN_LEFT);

        percentStyle = style;
    }

    return percentStyle;
}

From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.VendorPOXlsReport.java

License:Apache License

private void addTitle(Workbook p_workbook, Sheet p_sheet) throws Exception {
    // title font is black bold on white
    String EMEA = CompanyWrapper.getCurrentCompanyName();
    Font titleFont = p_workbook.createFont();
    titleFont.setUnderline(Font.U_NONE);
    titleFont.setFontName("Arial");
    titleFont.setFontHeightInPoints((short) 14);
    titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
    titleFont.setColor(IndexedColors.BLACK.getIndex());
    CellStyle titleStyle = p_workbook.createCellStyle();
    titleStyle.setWrapText(false);/* w  ww . j  ava  2  s.c  om*/
    titleStyle.setFont(titleFont);

    Row titleRow = getRow(p_sheet, 0);
    Cell cell_A_Title = getCell(titleRow, 0);
    cell_A_Title.setCellValue(EMEA + " " + bundle.getString("lb_po"));
    cell_A_Title.setCellStyle(titleStyle);
    p_sheet.setColumnWidth(0, 20 * 256);
}

From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.VendorPOXlsReport.java

License:Apache License

private CellStyle getRedCellStyle(Workbook p_workbook) throws Exception {
    if (redCellStyle == null) {
        Font redFont = p_workbook.createFont();
        redFont.setFontName("Arial");
        redFont.setUnderline(Font.U_NONE);
        redFont.setFontHeightInPoints((short) 10);

        CellStyle style = p_workbook.createCellStyle();
        style.setFont(redFont);
        style.setWrapText(true);//  w w w.  ja va 2 s. c  om
        style.setFillPattern(CellStyle.SOLID_FOREGROUND);
        style.setFillForegroundColor(IndexedColors.RED.getIndex());

        redCellStyle = style;
    }
    return redCellStyle;
}

From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.VendorPOXlsReport.java

License:Apache License

private CellStyle getDateStyle(Workbook p_workbook) throws Exception {
    if (dateStyle == null) {
        Font dateFont = p_workbook.createFont();
        dateFont.setFontName("Arial");
        dateFont.setFontHeightInPoints((short) 10);

        DataFormat format = p_workbook.createDataFormat();
        CellStyle cs = p_workbook.createCellStyle();
        cs.setFont(dateFont);
        cs.setDataFormat(format.getFormat("M/d/yy"));
        cs.setWrapText(false);//from ww  w  .  j ava2  s.  c  om

        dateStyle = cs;
    }
    return dateStyle;
}