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.generator.TranslationVerificationReportGenerator.java

License:Apache License

private CellStyle getRtlContentStyle1(Workbook p_workbook) {
    Font font = p_workbook.createFont();
    font.setFontName("Arial");
    font.setFontHeightInPoints((short) 10);

    CellStyle style = p_workbook.createCellStyle();
    style.setFont(font);//from   ww w . j  a  v a  2s. c om
    style.setWrapText(true);
    style.setAlignment(CellStyle.ALIGN_RIGHT);
    style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
    style.setFillPattern(CellStyle.SOLID_FOREGROUND);
    style.setFillForegroundColor(IndexedColors.YELLOW.getIndex());

    return style;
}

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

License:Apache License

private CellStyle getHeaderStyle(Boolean isSuper) throws Exception {
    if (isSuper && headerStyleSuper != null) {
        return headerStyleSuper;
    }//  w w w .  jav  a2s .  com

    if (!isSuper && headerStyle != null) {
        return headerStyle;
    }

    Font font = workbook.createFont();
    font.setBoldweight(Font.BOLDWEIGHT_BOLD);
    if (isSuper) {
        font.setColor(IndexedColors.ORANGE.getIndex());
    } else {
        font.setColor(IndexedColors.BLACK.getIndex());
    }
    font.setUnderline(Font.U_NONE);
    font.setFontName("Arial");
    font.setFontHeightInPoints((short) 9);

    CellStyle cs = workbook.createCellStyle();
    cs.setFont(font);
    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);

    if (isSuper) {
        headerStyleSuper = cs;
        return headerStyleSuper;
    } else {
        headerStyle = cs;
        return headerStyle;
    }
}

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

License:Apache License

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

        contentStyle = style;
    }

    return contentStyle;
}

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

License:Apache License

private CellStyle getRejectedStyle(Workbook p_workbook) throws Exception {
    if (rejectedStyle == null) {
        Font rejectedFont = p_workbook.createFont();
        rejectedFont.setFontName("Times");
        rejectedFont.setUnderline(Font.U_NONE);
        rejectedFont.setFontHeightInPoints((short) 11);
        rejectedFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
        rejectedFont.setColor(IndexedColors.RED.getIndex());

        CellStyle style = p_workbook.createCellStyle();
        style.setFont(rejectedFont);//from  ww  w  .jav a  2  s .  co  m
        style.setWrapText(true);

        rejectedStyle = style;
    }

    return rejectedStyle;
}

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

License:Apache License

private CellStyle getRedStyle(Workbook p_workbook) throws Exception {
    if (redStyle == 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);// w ww  . j  a  v  a 2s .  c om
        style.setWrapText(true);
        style.setFillPattern(CellStyle.SOLID_FOREGROUND);
        style.setFillForegroundColor(IndexedColors.RED.getIndex());

        redStyle = style;
    }

    return redStyle;
}

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

License:Apache License

/**
 * Returns a cell format that the wrap has been set to true.
 *///from  w w  w  . j a v  a  2s . c  om
private CellStyle getWrapStyle(Workbook p_workbook) throws Exception {
    if (wrapStyle == null) {
        CellStyle style = p_workbook.createCellStyle();
        style.setWrapText(true);
        wrapStyle = style;
    }

    return wrapStyle;
}

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

License:Apache License

/**
 * Add title to the sheet/*from  w  w w  .  ja va 2 s.c o  m*/
 * 
 * @param p_sheet
 *            the sheet
 * @throws Exception
 */
private void addTitle(Workbook p_workbook, Sheet p_sheet) throws Exception {
    ResourceBundle bundle = PageHandler.getBundle(request.getSession());
    // 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);
    titleFont.setColor(IndexedColors.BLACK.getIndex());

    CellStyle titleStyle = p_workbook.createCellStyle();
    titleStyle.setFont(titleFont);
    titleStyle.setWrapText(false);

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

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

License:Apache License

/**
 * // ww  w  .j  ava  2s.  c  o m
 * @return format of the report content
 * @throws Exception
 */
private CellStyle getRtlContentStyle(Workbook p_workbook) throws Exception {
    if (rtlContentStyle == null) {
        CellStyle style = p_workbook.createCellStyle();
        Font font = p_workbook.createFont();
        font.setFontName("Arial");
        font.setFontHeightInPoints((short) 10);
        style.setFont(font);
        style.setWrapText(true);
        style.setAlignment(CellStyle.ALIGN_LEFT);

        rtlContentStyle = style;
    }

    return rtlContentStyle;
}

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

License:Apache License

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

        contentStyle = style;
    }

    return contentStyle;
}

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

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