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

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

Introduction

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

Prototype

DataFormat createDataFormat();

Source Link

Document

Returns the instance of DataFormat for this workbook.

Usage

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

License:Apache License

private CellStyle getTotalMoneyStyle(Workbook p_workbook) throws Exception {
    if (totalMoneyStyle == null) {
        String euroJavaNumberFormat = getCurrencyNumberFormat();
        DataFormat euroNumberFormat = p_workbook.createDataFormat();

        CellStyle cs = p_workbook.createCellStyle();
        cs.setDataFormat(euroNumberFormat.getFormat(euroJavaNumberFormat));
        cs.setWrapText(false);/*w  w  w  .ja  v a2s.co m*/
        cs.setFillPattern(CellStyle.SOLID_FOREGROUND);
        cs.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
        cs.setBorderTop(CellStyle.BORDER_THIN);
        cs.setBorderBottom(CellStyle.BORDER_THIN);

        totalMoneyStyle = cs;
    }
    return totalMoneyStyle;
}

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

License:Apache License

private CellStyle getFloatStyle(Workbook p_workbook) {
    if (floatStyle == null) {
        DataFormat formatDouble = p_workbook.createDataFormat();
        CellStyle cs = getCommonHeaderStyle(p_workbook);
        cs.setDataFormat(formatDouble.getFormat(DOUBLE_FORMAT));

        floatStyle = cs;/*from   w  ww  .j a v a2  s  .  c  om*/
    }
    return floatStyle;
}

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

License:Apache License

private CellStyle getFloatSumStyle(Workbook p_workbook) {
    if (floatSumStyle == null) {
        DataFormat formatDouble = p_workbook.createDataFormat();
        CellStyle cs = getCommonHeaderStyle(p_workbook);
        cs.setFillPattern(CellStyle.SOLID_FOREGROUND);
        cs.setFillForegroundColor(IndexedColors.ORANGE.getIndex());
        cs.setDataFormat(formatDouble.getFormat(DOUBLE_FORMAT));

        floatSumStyle = cs;//from  w ww. ja  v a 2  s  .  c o  m
    }
    return floatSumStyle;
}

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

License:Apache License

private CellStyle getMoneyStyle(Workbook p_workbook) {
    if (moneyStyle == null) {
        DataFormat moneyFormat = p_workbook.createDataFormat();
        CellStyle cs = getCommonHeaderStyle(p_workbook);
        cs.setDataFormat(moneyFormat.getFormat(moneyFormatString));

        moneyStyle = cs;/* w ww .jav  a2  s .  co m*/
    }
    return moneyStyle;
}

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

License:Apache License

private CellStyle getMoneySumStyle(Workbook p_workbook) {
    if (moneySumStyle == null) {
        DataFormat moneyFormat = p_workbook.createDataFormat();
        CellStyle cs = getCommonHeaderStyle(p_workbook);
        cs.setDataFormat(moneyFormat.getFormat(moneyFormatString));
        cs.setFillPattern(CellStyle.SOLID_FOREGROUND);
        cs.setFillForegroundColor(IndexedColors.ORANGE.getIndex());

        moneySumStyle = cs;/*  w w  w .ja v  a2s .c o m*/
    }
    return moneySumStyle;
}

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. ja  v a 2s  . 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 www.j a va2s  .  c  om
    }
    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);/*from w  w w .  j a  v a2 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  .  jav  a 2s  . 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 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);/*www . ja  v a  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;
}