ASF Bugzilla – Attachment 26298 Details for
Bug 50271
POI will always use "M/d/yy" to format a cell when user try to format a cell to date but without specifying format exactly even my locale is set to Germany.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to fix this issue
50271.patch (text/plain), 1.52 KB, created by
Wu, Fan
on 2010-11-15 05:05:18 UTC
(
hide
)
Description:
Patch to fix this issue
Filename:
MIME Type:
Creator:
Wu, Fan
Created:
2010-11-15 05:05:18 UTC
Size:
1.52 KB
patch
obsolete
>Index: src/java/org/apache/poi/ss/usermodel/DataFormatter.java >=================================================================== >--- src/java/org/apache/poi/ss/usermodel/DataFormatter.java (revision 1035197) >+++ src/java/org/apache/poi/ss/usermodel/DataFormatter.java (working copy) >@@ -91,6 +91,11 @@ > "(\\[COLOR\\s*\\d\\])|(\\[COLOR\\s*[0-5]\\d\\])", Pattern.CASE_INSENSITIVE); > > /** >+ * The locale used for formating values. >+ */ >+ private final Locale currentLocale; >+ >+ /** > * The decimal symbols of the locale used for formatting values. > */ > private final DecimalFormatSymbols decimalSymbols; >@@ -126,6 +131,7 @@ > * Creates a formatter using the given locale. > */ > public DataFormatter(Locale locale) { >+ currentLocale = locale; > dateSymbols = new DateFormatSymbols(locale); > decimalSymbols = new DecimalFormatSymbols(locale); > generalWholeNumFormat = new DecimalFormat("#", decimalSymbols); >@@ -170,6 +176,13 @@ > } > > int formatIndex = cell.getCellStyle().getDataFormat(); >+ >+ // when formatIndex equals 0xe, formatCode is empty. We should handle this case separately >+ // so that the locale can be applied. >+ if (formatIndex == 0xe) { >+ return DateFormat.getDateInstance(DateFormat.SHORT, currentLocale); >+ } >+ > String formatStr = cell.getCellStyle().getDataFormatString(); > if(formatStr == null || formatStr.trim().length() == 0) { > return null;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 50271
:
26297
| 26298