List of usage examples for org.apache.poi.ss.util DateFormatConverter getPrefixForLocale
public static String getPrefixForLocale(Locale locale)
From source file:br.com.tecsinapse.exporter.ExporterFormatter.java
License:LGPL
public ExporterFormatter(Locale locale) { this.locale = locale; this.dateTimeFormat = (SimpleDateFormat) SimpleDateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, locale); this.dateFormat = (SimpleDateFormat) SimpleDateFormat.getDateInstance(DateFormat.MEDIUM, locale); this.timeFormat = (SimpleDateFormat) SimpleDateFormat.getTimeInstance(DateFormat.SHORT, locale); this.decimalFormat = (DecimalFormat) DecimalFormat.getInstance(locale); this.integerFormat = (DecimalFormat) DecimalFormat.getIntegerInstance(locale); this.currencyFormat = (DecimalFormat) DecimalFormat.getCurrencyInstance(locale); this.cellDateTimeFormat = DateFormatConverter.convert(locale, dateTimeFormat.toPattern()); this.cellDateFormat = DateFormatConverter.convert(locale, dateFormat.toPattern()); this.cellTimeFormat = DateFormatConverter.convert(locale, timeFormat.toPattern()); this.cellCurrencyFormat = DateFormatConverter.getPrefixForLocale(locale) + currencyFormat.toLocalizedPattern() + CELL_SUFIX_FORMAT; this.cellDecimalFormat = DateFormatConverter.getPrefixForLocale(locale) + decimalFormat.toLocalizedPattern() + CELL_SUFIX_FORMAT;// w w w.ja v a 2s. c o m this.cellIntegerFormat = DateFormatConverter.getPrefixForLocale(locale) + integerFormat.toLocalizedPattern() + CELL_SUFIX_FORMAT; }
From source file:br.com.tecsinapse.exporter.ExporterFormatter.java
License:LGPL
public ExporterFormatter(String dateTimeFormat, String dateFormat, String timeFormat, String decimalFormat, String integerFormat, String currencyFormat, Locale locale) { this.locale = locale; this.dateTimeFormat = new SimpleDateFormat(dateTimeFormat, locale); this.dateFormat = new SimpleDateFormat(dateFormat, locale); this.timeFormat = new SimpleDateFormat(timeFormat, locale); this.decimalFormat = new DecimalFormat(decimalFormat, DecimalFormatSymbols.getInstance(locale)); this.integerFormat = new DecimalFormat(integerFormat, DecimalFormatSymbols.getInstance(locale)); this.currencyFormat = new DecimalFormat(currencyFormat, DecimalFormatSymbols.getInstance(locale)); this.cellDateTimeFormat = DateFormatConverter.convert(locale, dateTimeFormat); this.cellDateFormat = DateFormatConverter.convert(locale, dateFormat); this.cellTimeFormat = DateFormatConverter.convert(locale, timeFormat); this.cellCurrencyFormat = DateFormatConverter.getPrefixForLocale(locale) + this.currencyFormat.toLocalizedPattern() + CELL_SUFIX_FORMAT; this.cellDecimalFormat = DateFormatConverter.getPrefixForLocale(locale) + this.decimalFormat.toLocalizedPattern() + CELL_SUFIX_FORMAT; this.cellIntegerFormat = DateFormatConverter.getPrefixForLocale(locale) + this.integerFormat.toLocalizedPattern() + CELL_SUFIX_FORMAT; }