Java Code Examples for org.apache.poi.util.LocaleUtil#getUserLocale()

The following examples show how to use org.apache.poi.util.LocaleUtil#getUserLocale() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HSSFCell.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns a string representation of the cell
 *
 * This method returns a simple representation,
 * anything more complex should be in user code, with
 * knowledge of the semantics of the sheet being processed.
 *
 * Formula cells return the formula string,
 * rather than the formula result.
 * Dates are displayed in dd-MMM-yyyy format
 * Errors are displayed as #ERR<errIdx>
 */
public String toString() {
    switch (getCellTypeEnum()) {
        case BLANK:
            return "";
        case BOOLEAN:
            return getBooleanCellValue()?"TRUE":"FALSE";
        case ERROR:
            return ErrorEval.getText((( BoolErrRecord ) _record).getErrorValue());
        case FORMULA:
            return getCellFormula();
        case NUMERIC:
            //TODO apply the dataformat for this cell
            if (HSSFDateUtil.isCellDateFormatted(this)) {
                SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy", LocaleUtil.getUserLocale());
                sdf.setTimeZone(LocaleUtil.getUserTimeZone());
                return sdf.format(getDateCellValue());
            }
return  String.valueOf(getNumericCellValue());
        case STRING:
            return getStringCellValue();
        default:
            return "Unknown Cell Type: " + getCellTypeEnum();
    }
}
 
Example 2
Source File: ExcelStyleDateFormatter.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public ExcelStyleDateFormatter(String pattern) {
    super(processFormatPattern(pattern), LocaleUtil.getUserLocale());
}
 
Example 3
Source File: CellGeneralFormatter.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/** Creates a new general formatter. */
public CellGeneralFormatter() {
    this(LocaleUtil.getUserLocale());
}
 
Example 4
Source File: HSSFDataFormatter.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Creates a formatter using the {@link Locale#getDefault() default locale}.
 */
public HSSFDataFormatter() {
    this(LocaleUtil.getUserLocale());
}
 
Example 5
Source File: DataFormatter1.java    From easyexcel with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a formatter using the {@link Locale#getDefault() default locale}.
 *
 * @param emulateCSV
 *            whether to emulate CSV output.
 */
public DataFormatter1(boolean emulateCSV) {
    this(LocaleUtil.getUserLocale(), true, emulateCSV);
}
 
Example 6
Source File: DataFormatter.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a formatter using the {@link Locale#getDefault() default locale}.
 *
 * @param  emulateCSV whether to emulate CSV output.
 */
public DataFormatter(boolean emulateCSV) {
    this(LocaleUtil.getUserLocale(), true, emulateCSV);
}
 
Example 7
Source File: CellDateFormatter.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a new date formatter with the given specification.
 *
 * @param format The format.
 */
public CellDateFormatter(String format) {
    this(LocaleUtil.getUserLocale(), format);
}
 
Example 8
Source File: CellNumberFormatter.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a new cell number formatter.
 *
 * @param format The format to parse.
 */
public CellNumberFormatter(String format) {
    this(LocaleUtil.getUserLocale(), format);
}
 
Example 9
Source File: CellFormatPart.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Create an object to represent a format part.
 *
 * @param desc The string to parse.
 */
public CellFormatPart(String desc) {
    this(LocaleUtil.getUserLocale(), desc);
}
 
Example 10
Source File: CellFormatter.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a new formatter object, storing the format in {@link #format}.
 *
 * @param format The format.
 */
public CellFormatter(String format) {
    this(LocaleUtil.getUserLocale(), format);
}
 
Example 11
Source File: FormatTrackingHSSFListener.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a format tracking wrapper around the given listener, using
 * the {@link Locale#getDefault() default locale} for the formats.
 * 
 * @param childListener the listener to be wrapped
 */
public FormatTrackingHSSFListener(HSSFListener childListener) {
	this(childListener, LocaleUtil.getUserLocale());
}