Example usage for org.apache.poi.ss.usermodel Workbook createCellStyle

List of usage examples for org.apache.poi.ss.usermodel Workbook createCellStyle

Introduction

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

Prototype

CellStyle createCellStyle();

Source Link

Document

Create a new Cell style and add it to the workbook's style table

Usage

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

License:Apache License

private void addTitle(Workbook p_workbook, Sheet p_sheet) throws Exception {
    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  w w  .  j  a  v  a2  s.  c  o  m*/
    titleStyle.setFont(titleFont);

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

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

License:Apache License

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

        DataFormat format = p_workbook.createDataFormat();
        CellStyle cs = p_workbook.createCellStyle();
        cs.setFont(defaultFont);//from w  w w .j  a v  a 2 s  .  c om
        cs.setDataFormat(format.getFormat(DEFAULT_DATE_FORMAT));
        cs.setWrapText(false);

        dateStyle = cs;
    }

    return dateStyle;
}

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

License:Apache License

private CellStyle getMoneyStyle(Workbook p_workbook) throws Exception {
    if (moneyStyle == null) {
        Font defaultFont = p_workbook.createFont();
        defaultFont.setFontName("Arial");
        defaultFont.setFontHeightInPoints((short) 10);

        DataFormat euroNumberFormat = p_workbook.createDataFormat();
        CellStyle cs = p_workbook.createCellStyle();
        cs.setFont(defaultFont);//from w  ww.  j  av a  2  s  .c  o m
        cs.setWrapText(false);
        cs.setDataFormat(euroNumberFormat.getFormat(CurrencyThreadLocal.getMoneyFormatString()));

        moneyStyle = cs;
    }

    return moneyStyle;
}

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);//w w w . j a  v a 2  s .c  om

        wrongJobStyle = cs;
    }

    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);/*from  w w  w .  j  a va 2  s  .c  o m*/
        cs.setWrapText(true);
        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.ReviewerVendorPoXlsReportHelper.java

License:Apache License

private CellStyle getTotalMoneyStyle(Workbook p_workbook) throws Exception {
    if (totalMoneyStyle == null) {
        DataFormat euroNumberFormat = p_workbook.createDataFormat();
        CellStyle cs = p_workbook.createCellStyle();
        cs.setDataFormat(euroNumberFormat.getFormat(CurrencyThreadLocal.getMoneyFormatString()));
        cs.setWrapText(false);/*  w w  w.  j  a  va 2  s .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());

        totalMoneyStyle = cs;
    }

    return totalMoneyStyle;
}

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 ww.  j  ava2s  .  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);/*from   www.  ja va 2 s .  c  om*/
        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.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   www .  j  ava  2  s  . co 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);//ww w . j  a v  a  2 s .c  om
    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);
}