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.webapp.pagehandler.administration.reports.generator.CommentsAnalysisReportGenerator.java

License:Apache License

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

        CellStyle style = p_workbook.createCellStyle();
        style.setFont(font);/*from ww w.  ja v  a2 s  .com*/
        style.setWrapText(true);
        style.setAlignment(CellStyle.ALIGN_RIGHT);
        style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);

        rtlContentStyle = style;
    }

    return rtlContentStyle;
}

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

License:Apache License

private CellStyle getUnlockedStyle(Workbook p_workbook) {
    if (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  v a 2 s  . c  o  m
        style.setLocked(false);
        style.setWrapText(true);
        style.setAlignment(CellStyle.ALIGN_LEFT);
        style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);

        unlockedStyle = style;
    }

    return unlockedStyle;
}

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

License:Apache License

private CellStyle getUnlockedRightStyle(Workbook p_workbook) {
    if (unlockedRightStyle == 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  v  a  2  s  . com*/
        style.setLocked(false);
        style.setWrapText(true);
        style.setAlignment(CellStyle.ALIGN_RIGHT);
        style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);

        unlockedRightStyle = style;
    }

    return unlockedRightStyle;
}

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

License:Apache License

private CellStyle getTitleStyle(Workbook p_workBook) {
    if (titleStyle == null) {
        // 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);//from   w ww  . j a v a2  s  .c o m

        titleStyle = cs;
    }

    return titleStyle;
}

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

License:Apache License

private CellStyle getUnlockedRightStyle(Workbook p_workbook) throws Exception {
    if (unlockedRightStyle == 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 av a2s.  co m*/
        style.setLocked(false);
        style.setWrapText(true);
        style.setAlignment(CellStyle.ALIGN_RIGHT);
        style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);

        unlockedRightStyle = style;
    }

    return unlockedRightStyle;
}

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

License:Apache License

private CellStyle getRedRightStyle(Workbook p_workbook) throws Exception {
    CellStyle style = p_workbook.createCellStyle();
    Font font = p_workbook.createFont();
    if (hightLightRightStyle == null) {
        font.setBoldweight(Font.BOLDWEIGHT_BOLD);
        font.setColor(IndexedColors.BLACK.getIndex());
        font.setUnderline(Font.U_NONE);
        font.setFontName("Arial");
        font.setFontHeightInPoints((short) 10);

        style.setWrapText(true);//from   w w  w  .j  a va  2  s.  c o  m
        style.setAlignment(CellStyle.ALIGN_RIGHT);
        style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
        style.setFillPattern(CellStyle.SOLID_FOREGROUND);
        style.setFillForegroundColor(IndexedColors.ROSE.getIndex());
        hightLightRightStyle = style;
    }

    return hightLightRightStyle;
}

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

License:Apache License

/**
 * /*from www . j  a v a 2  s . c  o m*/
 * @return format of the unlocked cell
 * @throws Exception
 */
private CellStyle getUnlockedStyle(Workbook p_workbook) throws Exception {
    if (unlockedStyle == null) {
        Font font = p_workbook.createFont();
        font.setFontName("Arial");
        font.setFontHeightInPoints((short) 10);

        CellStyle style = p_workbook.createCellStyle();
        style.setFont(font);
        style.setLocked(false);
        style.setWrapText(true);
        style.setAlignment(CellStyle.ALIGN_LEFT);
        style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);

        unlockedStyle = style;
    }

    return unlockedStyle;
}

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

License:Apache License

private CellStyle getRedStyle(Workbook p_workbook) throws Exception {
    CellStyle style = p_workbook.createCellStyle();
    Font font = p_workbook.createFont();
    if (hightLightStyle == null) {
        font.setBoldweight(Font.BOLDWEIGHT_BOLD);
        font.setColor(IndexedColors.BLACK.getIndex());
        font.setUnderline(Font.U_NONE);
        font.setFontName("Arial");
        font.setFontHeightInPoints((short) 10);

        style.setWrapText(true);// w ww . j  av  a2 s  .  c om
        style.setAlignment(CellStyle.ALIGN_LEFT);
        style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
        style.setFillPattern(CellStyle.SOLID_FOREGROUND);
        style.setFillForegroundColor(IndexedColors.ROSE.getIndex());
        hightLightStyle = style;
    }

    return hightLightStyle;
}

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

License:Apache License

private void addTitle(Workbook p_workbook, Sheet p_sheet) throws Exception {
    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);
    CellStyle titleStyle = p_workbook.createCellStyle();
    titleStyle.setWrapText(false);//from  w  w  w  .j a  v  a2s.co m
    titleStyle.setFont(titleFont);

    Row firRow = getRow(p_sheet, 0);
    Cell titleCell = getCell(firRow, 0);
    titleCell.setCellValue(EMEA + " " + m_bundle.getString("online_jobs_for_ip_translator"));
    titleCell.setCellStyle(titleStyle);
    p_sheet.setColumnWidth(0, 20 * 256);
}

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

License:Apache License

private void addTotalsPerLang(Workbook p_workbook, Sheet p_sheet, final int p_sheetCategory, IntHolder p_row)
        throws Exception {
    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 subTotalStyle = p_workbook.createCellStyle();
    subTotalStyle.setFont(subTotalFont);

    String title = m_bundle.getString("lb_total_cost_per_lang");
    int row = p_row.getValue() + 4; // skip a row
    ArrayList<String> locales = new ArrayList<String>(totalCost.keySet());
    SortUtil.sort(locales);/*from ww  w  .ja  v a 2s . c  o  m*/

    int col = m_data.getSumStartCol();
    Row theRow = getRow(p_sheet, row);

    Cell cell_Title = getCell(theRow, col - 3);
    cell_Title.setCellValue(title);
    cell_Title.setCellStyle(subTotalStyle);

    File imgFile = File.createTempFile("GSJobChart", ".png");
    JfreeCharUtil.drawPieChart2D("", totalCostDate, imgFile);
    Drawing patriarch = p_sheet.createDrawingPatriarch();
    XSSFClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, 15, row - 1, 22, row + 24);
    ByteArrayOutputStream img_bytes = new ByteArrayOutputStream();
    InputStream is = imgFile.toURI().toURL().openStream();
    int b;
    while ((b = is.read()) != -1) {
        img_bytes.write(b);
    }
    is.close();
    int i = p_workbook.addPicture(img_bytes.toByteArray(), SXSSFWorkbook.PICTURE_TYPE_PNG);
    patriarch.createPicture(anchor, i);
    for (String locale : locales) {
        List<Integer> indexs = totalCost.get(locale);
        StringBuffer values = new StringBuffer();
        for (Integer index : indexs) {
            if (values.length() == 0) {
                values.append("SUM(");
            } else {
                values.append("+");
            }

            values.append(totalCol).append(index);
        }
        values.append(")");

        Row perRow = getRow(p_sheet, row);

        Cell cell_Locale = getCell(perRow, col - 1);
        cell_Locale.setCellValue(locale);
        cell_Locale.setCellStyle(getContentStyle(p_workbook));
        Cell cell_Total = getCell(perRow, col);
        cell_Total.setCellFormula(values.toString());
        cell_Total.setCellStyle(getMoneyStyle(p_workbook));
        row++;
    }

    // Reset total column number for every sheet.
    totalCol = null;
}