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.OnlineJobsReportForIPTranslatorGenerator.java

License:Apache License

private CellStyle getDateStyle(Workbook p_workbook) throws Exception {
    if (dateStyle == null) {
        DataFormat dataFormat = p_workbook.createDataFormat();

        Font dateFont = p_workbook.createFont();
        dateFont.setFontName("Arial");
        dateFont.setFontHeightInPoints((short) 10);

        CellStyle cs = p_workbook.createCellStyle();
        cs.setWrapText(false);/*from   w  w w.  j  ava  2  s .com*/
        cs.setFont(dateFont);
        cs.setDataFormat(dataFormat.getFormat("M/d/yy"));

        dateStyle = cs;
    }
    return dateStyle;
}

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

License:Apache License

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

        CellStyle cs = p_workbook.createCellStyle();
        cs.setDataFormat(euroNumberFormat.getFormat(euroJavaNumberFormat));
        cs.setWrapText(false);/*from   w  w w.j a va  2s  .  c  om*/

        moneyStyle = cs;
    }

    return moneyStyle;
}

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

License:Apache License

private CellStyle getFailedDateStyle(Workbook p_workbook) throws Exception {
    if (failedDateStyle == null) {
        DataFormat dataFormat = p_workbook.createDataFormat();

        Font dateFont = p_workbook.createFont();
        dateFont.setFontName("Arial");
        dateFont.setFontHeightInPoints((short) 10);

        CellStyle cs = p_workbook.createCellStyle();
        cs.setWrapText(false);//  ww w.  j a  v  a 2s.c  om
        cs.setFont(dateFont);
        cs.setDataFormat(dataFormat.getFormat("M/d/yy"));
        cs.setFillPattern(CellStyle.SOLID_FOREGROUND);
        cs.setFillForegroundColor(IndexedColors.RED.getIndex());
        failedDateStyle = cs;
    }
    return failedDateStyle;
}

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

License:Apache License

private CellStyle getFailedTimeStyle(Workbook p_workbook) throws Exception {
    if (failedTimeStyle == null) {
        DataFormat dataFormat = p_workbook.createDataFormat();

        CellStyle cs = p_workbook.createCellStyle();
        cs.setWrapText(false);//from   w w w .  ja v  a 2  s  .c o m
        cs.setDataFormat(dataFormat.getFormat("h:mm:ss AM/PM"));
        cs.setFillPattern(CellStyle.SOLID_FOREGROUND);
        cs.setFillForegroundColor(IndexedColors.RED.getIndex());
        failedTimeStyle = cs;
    }
    return failedTimeStyle;
}

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

License:Apache License

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

        CellStyle cs = p_workbook.createCellStyle();
        cs.setWrapText(false);/*from  w ww . j  av  a2 s .c  o  m*/
        cs.setDataFormat(euroNumberFormat.getFormat(euroJavaNumberFormat));
        cs.setFillPattern(CellStyle.SOLID_FOREGROUND);
        cs.setFillForegroundColor(IndexedColors.RED.getIndex());
        failedMoneyStyle = cs;
    }
    return failedMoneyStyle;
}

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);/*from  w  ww.  jav a2  s.  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 ww  w  .j  a va2 s  . c  o  m
    }
    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;/* w w  w  .  j  av  a  2 s.  co 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;/*from   w ww. ja  va 2 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;//from  w  ww.  j  av  a2  s  .  c  om
    }
    return moneySumStyle;
}