Example usage for org.apache.poi.ss.usermodel Font setFontHeightInPoints

List of usage examples for org.apache.poi.ss.usermodel Font setFontHeightInPoints

Introduction

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

Prototype


void setFontHeightInPoints(short height);

Source Link

Document

set the font height

Usage

From source file:com.globalsight.everest.qachecks.QAChecker.java

License:Apache License

private CellStyle getContentStyle(Workbook p_workbook) {
    if (m_contentStyle == null) {
        CellStyle style = p_workbook.createCellStyle();
        style.setWrapText(true);/*from   w w w. j ava  2 s.  co  m*/
        style.setAlignment(CellStyle.ALIGN_LEFT);
        style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
        Font font = p_workbook.createFont();
        font.setFontName("Arial");
        font.setFontHeightInPoints((short) 10);
        style.setFont(font);

        m_contentStyle = style;
    }

    return m_contentStyle;
}

From source file:com.globalsight.everest.qachecks.QAChecker.java

License:Apache License

private CellStyle getHeaderStyle(Workbook p_workbook) {
    if (m_headerStyle == null) {
        Font font = p_workbook.createFont();
        font.setBoldweight(Font.BOLDWEIGHT_BOLD);
        font.setColor(IndexedColors.BLACK.getIndex());
        font.setUnderline(Font.U_NONE);
        font.setFontName("Times");
        font.setFontHeightInPoints((short) 11);

        CellStyle cs = p_workbook.createCellStyle();
        cs.setFont(font);/*from  w  ww.  j  a  v a  2s .  co  m*/
        cs.setWrapText(true);
        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);

        m_headerStyle = cs;
    }

    return m_headerStyle;
}

From source file:com.globalsight.everest.qachecks.QAChecker.java

License:Apache License

private CellStyle getRtlContentStyle(Workbook p_workbook) {
    if (m_rtlContentStyle == null) {
        Font font = p_workbook.createFont();
        font.setFontName("Arial");
        font.setFontHeightInPoints((short) 10);

        CellStyle style = p_workbook.createCellStyle();
        style.setFont(font);/*  w w w . j a va2  s. c  om*/
        style.setWrapText(true);
        style.setAlignment(CellStyle.ALIGN_RIGHT);
        style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);

        m_rtlContentStyle = style;
    }

    return m_rtlContentStyle;
}

From source file:com.globalsight.everest.qachecks.QAChecker.java

License:Apache License

private CellStyle getUnlockedStyle(Workbook p_workbook) {
    if (m_unlockedStyle == null) {
        Font font = p_workbook.createFont();
        font.setFontName("Arial");
        font.setFontHeightInPoints((short) 10);

        CellStyle style = p_workbook.createCellStyle();
        style.setFont(font);/*from w  w w . j  a va  2  s.  com*/
        style.setLocked(false);
        style.setWrapText(true);
        style.setAlignment(CellStyle.ALIGN_LEFT);
        style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);

        m_unlockedStyle = style;
    }

    return m_unlockedStyle;
}

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

License:Apache License

private void addTitle(Workbook p_workbook, Sheet p_sheet, String sheetTitle) throws Exception {
    // title font is black bold on white
    Font titleFont = p_workbook.createFont();
    titleFont.setUnderline(Font.U_NONE);
    titleFont.setFontName("Times");
    titleFont.setFontHeightInPoints((short) 14);
    titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
    CellStyle titileCs = p_workbook.createCellStyle();
    titileCs.setWrapText(false);/*from   w ww . j  a v a 2 s  .  c om*/
    titileCs.setFont(titleFont);

    Row titleRow = getRow(p_sheet, 0);
    Cell titleCell = getCell(titleRow, 0);
    titleCell.setCellValue(sheetTitle);
    titleCell.setCellStyle(titileCs);
    p_sheet.setColumnWidth(0, 22 * 256);
}

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

License:Apache License

private CellStyle getContentStyle(Workbook p_workbook) throws Exception {
    if (contentStyle == null) {
        CellStyle style = p_workbook.createCellStyle();
        style.setWrapText(true);/*from   w  ww  .j  av a 2s .c  o m*/
        style.setAlignment(CellStyle.ALIGN_LEFT);
        style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
        Font font = p_workbook.createFont();
        font.setFontName("Arial");
        font.setFontHeightInPoints((short) 10);
        style.setFont(font);

        contentStyle = style;
    }

    return contentStyle;
}

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

License:Apache License

private void setFormats() throws IOException {
    // Set title format
    Font titleFont = this.workbook.createFont();
    titleFont.setUnderline(Font.U_NONE);
    titleFont.setFontName("Times");
    titleFont.setFontHeightInPoints((short) 14);
    titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
    titleFont.setColor(IndexedColors.BLACK.getIndex());

    this.titleStyle = this.workbook.createCellStyle();
    titleStyle.setFont(titleFont);/*  www.j av  a2  s . co m*/
    titleStyle.setWrapText(false);

    // Set header format
    Font headerFont = this.workbook.createFont();
    headerFont.setUnderline(Font.U_NONE);
    headerFont.setFontName("Times");
    headerFont.setFontHeightInPoints((short) 11);
    headerFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
    headerFont.setColor(IndexedColors.BLACK.getIndex());

    this.headerStyle = this.workbook.createCellStyle();
    headerStyle.setFont(headerFont);
    headerStyle.setWrapText(true);
    headerStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
    headerStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
    headerStyle.setBorderBottom(CellStyle.BORDER_THIN);
    headerStyle.setBorderRight(CellStyle.BORDER_THIN);
    headerStyle.setBorderTop(CellStyle.BORDER_THIN);
    headerStyle.setBorderLeft(CellStyle.BORDER_THIN);

    // Set content format
    Font font = this.workbook.createFont();
    font.setFontName("Arial");
    font.setFontHeightInPoints((short) 10);

    this.stringStyle = this.workbook.createCellStyle();
    stringStyle.setAlignment(CellStyle.ALIGN_LEFT);
    stringStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
    this.intStyle = this.workbook.createCellStyle();
    intStyle.setAlignment(CellStyle.ALIGN_LEFT);
    intStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);

    // Set money format
    String moneyFormatString = CurrencyThreadLocal.getMoneyFormatString();
    DataFormat moneyFormat = this.workbook.createDataFormat();
    this.moneyStyle = this.workbook.createCellStyle();
    moneyStyle.setDataFormat(moneyFormat.getFormat(moneyFormatString));
    moneyStyle.setWrapText(false);

    // Set total format
    Font totalFont = this.workbook.createFont();
    totalFont.setUnderline(Font.U_NONE);
    totalFont.setFontName("Arial");
    totalFont.setFontHeightInPoints((short) 10);
    totalFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
    totalFont.setColor(IndexedColors.BLACK.getIndex());

    this.totalStyle = this.workbook.createCellStyle();
    totalStyle.setFont(totalFont);
    totalStyle.setWrapText(true);
    totalStyle.setBorderTop(CellStyle.BORDER_THIN);
    totalStyle.setBorderBottom(CellStyle.BORDER_THIN);
    totalStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
    totalStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());

    // Set total money format
    this.totalMoneyStyle = this.workbook.createCellStyle();
    totalMoneyStyle.setDataFormat(moneyFormat.getFormat(moneyFormatString));
    totalMoneyStyle.setWrapText(false);
    totalMoneyStyle.setBorderTop(CellStyle.BORDER_THIN);
    totalMoneyStyle.setBorderBottom(CellStyle.BORDER_THIN);
    totalMoneyStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
    totalMoneyStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
}

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

License:Apache License

/**
 * Add title to the sheet//  w  w  w .  ja  v a  2  s  .  co  m
 * 
 * @param p_workBook
 * @param p_sheet
 *            the sheet
 * @throws Exception
 */
private void addTitle(Workbook p_workBook, Sheet p_sheet) throws Exception {
    ResourceBundle bundle = m_bundle;
    // Title font is black bold on white
    Font titleFont = p_workBook.createFont();
    titleFont.setUnderline(Font.U_NONE);
    titleFont.setFontName("Times");
    titleFont.setFontHeightInPoints((short) 14);
    titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
    CellStyle cs = p_workBook.createCellStyle();
    cs.setFont(titleFont);

    Row titleRow = getRow(p_sheet, 0);
    Cell titleCell = getCell(titleRow, 0);
    titleCell.setCellValue(bundle.getString("character_count_report"));
    titleCell.setCellStyle(cs);
}

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

License:Apache License

private CellStyle getHeaderStyle(Workbook p_workbook) {
    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("Times");
        font.setFontHeightInPoints((short) 11);

        CellStyle cs = p_workbook.createCellStyle();
        cs.setFont(font);/*from   www  . j av  a 2 s . com*/
        cs.setWrapText(true);
        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.generator.CommentsAnalysisReportGenerator.java

License:Apache License

private CellStyle getContentStyle(Workbook p_workbook) {
    if (contentStyle == null) {
        CellStyle style = p_workbook.createCellStyle();
        style.setWrapText(true);/*w  ww .  ja  v a2  s  . c om*/
        style.setAlignment(CellStyle.ALIGN_LEFT);
        style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
        Font font = p_workbook.createFont();
        font.setFontName("Arial");
        font.setFontHeightInPoints((short) 10);
        style.setFont(font);

        contentStyle = style;
    }

    return contentStyle;
}