Example usage for org.apache.poi.ss.usermodel DataFormat getFormat

List of usage examples for org.apache.poi.ss.usermodel DataFormat getFormat

Introduction

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

Prototype

String getFormat(short index);

Source Link

Document

get the format string that matches the given format index

Usage

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

License:Apache License

private CellStyle getPercentStyle(Workbook p_workbook) {
    if (percentStyle == null) {
        DataFormat percentFormat = p_workbook.createDataFormat();
        CellStyle cs = getCommonHeaderStyle(p_workbook);
        cs.setDataFormat(percentFormat.getFormat(PERCENT_FORMAT));

        percentStyle = cs;//from   w w  w  .j a  v  a  2 s . c om
    }
    return percentStyle;
}

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

License:Apache License

private CellStyle getPercentSumStyle(Workbook p_workbook) {
    if (percentSumStyle == null) {
        DataFormat percentFormat = p_workbook.createDataFormat();

        CellStyle cs = getCommonHeaderStyle(p_workbook);
        cs.setDataFormat(percentFormat.getFormat(PERCENT_FORMAT));
        cs.setFillPattern(CellStyle.SOLID_FOREGROUND);
        cs.setFillForegroundColor(IndexedColors.ORANGE.getIndex());

        percentSumStyle = cs;/*from  ww  w .j  a va2 s.co m*/
    }
    return percentSumStyle;
}

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 .j  a  va2  s .  c o  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  . ja va2 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 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);/*from w w w . j a  va  2 s.co  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.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);//  ww w  .  j  a  v a 2 s  .c  om
        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 CellStyle getDateStyle(Workbook p_workbook) throws Exception {
    if (dateStyle == null) {
        Font dateFont = p_workbook.createFont();
        dateFont.setFontName("Arial");
        dateFont.setFontHeightInPoints((short) 10);

        DataFormat format = p_workbook.createDataFormat();
        CellStyle cs = p_workbook.createCellStyle();
        cs.setFont(dateFont);/*  w w w .ja va2 s.  co  m*/
        cs.setDataFormat(format.getFormat("M/d/yy"));
        cs.setWrapText(false);

        dateStyle = cs;
    }
    return dateStyle;
}

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

License:Apache License

private CellStyle getFailedDateStyle(Workbook p_workbook) throws Exception {
    if (failedDateStyle == null) {
        Font dateFont = p_workbook.createFont();
        dateFont.setFontName("Arial");
        dateFont.setFontHeightInPoints((short) 10);

        DataFormat format = p_workbook.createDataFormat();
        CellStyle cs = p_workbook.createCellStyle();
        cs.setFont(dateFont);//from  www . ja  v a  2  s.co m
        cs.setDataFormat(format.getFormat("M/d/yy"));
        cs.setWrapText(false);
        cs.setFillPattern(CellStyle.SOLID_FOREGROUND);
        cs.setFillForegroundColor(IndexedColors.RED.getIndex());

        failedDateStyle = cs;
    }
    return failedDateStyle;
}

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

License:Apache License

private CellStyle getMoneyStyle(Workbook p_workbook) throws Exception {
    if (moneyStyle == null) {
        String euroJavaNumberFormat = getNumberFormatString();
        DataFormat euroNumberFormat = p_workbook.createDataFormat();

        CellStyle cs = p_workbook.createCellStyle();
        cs.setDataFormat(euroNumberFormat.getFormat(euroJavaNumberFormat));
        cs.setWrapText(false);/*www.  j  a  v  a2  s  .co  m*/

        moneyStyle = cs;
    }
    return moneyStyle;
}

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

License:Apache License

private CellStyle getFailedMoneyStyle(Workbook p_workbook) throws Exception {
    if (failedMoneyStyle == null) {
        String euroJavaNumberFormat = getNumberFormatString();
        DataFormat euroNumberFormat = p_workbook.createDataFormat();

        CellStyle cs = p_workbook.createCellStyle();
        cs.setWrapText(false);//from  ww w  .ja  va 2 s  . c  o  m
        cs.setDataFormat(euroNumberFormat.getFormat(euroJavaNumberFormat));
        cs.setFillPattern(CellStyle.SOLID_FOREGROUND);
        cs.setFillForegroundColor(IndexedColors.RED.getIndex());

        failedMoneyStyle = cs;
    }
    return failedMoneyStyle;
}