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

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

Introduction

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

Prototype

void setWrapText(boolean wrapped);

Source Link

Document

Set whether the text should be wrapped.

Usage

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);//  w ww .  ja  va2s .co  m
        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  w w. jav a2 s .co 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 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);/*  ww  w  .j  a  va2  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);
        cs.setBorderTop(CellStyle.BORDER_THIN);
        cs.setBorderBottom(CellStyle.BORDER_THIN);
        cs.setFillPattern(CellStyle.SOLID_FOREGROUND);
        cs.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());

        totalMoneyStyle = cs;/*from ww  w  .  j av a2s  .c  o  m*/
    }

    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;//  w w w. j  ava  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);/*from w w w . j a  v a2s.  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);

        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);
        style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
        Font font = p_workbook.createFont();
        font.setFontName("Arial");
        font.setFontHeightInPoints((short) 10);
        style.setFont(font);//from   w  w w  .  j a v  a2s .  c o  m

        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);
    titleStyle.setFont(titleFont);//from   ww w  . j  a v  a 2  s.  co  m

    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);//  www.  ja va 2 s  . c  o  m
        style.setWrapText(true);
        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);
    titleStyle.setFont(titleFont);/*from   w  w  w. j  a va2  s. c  o  m*/

    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);
}