You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2012/03/16 12:45:49 UTC
DO NOT REPLY [Bug 52928] New: Provide utility methods to convert
Java Date formats into Excel date formats
https://issues.apache.org/bugzilla/show_bug.cgi?id=52928
Bug #: 52928
Summary: Provide utility methods to convert Java Date formats
into Excel date formats
Product: POI
Version: unspecified
Platform: PC
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: POI Overall
AssignedTo: dev@poi.apache.org
ReportedBy: jim-apache@spudsoft.co.uk
Classification: Unclassified
I need to convert java DateFormat patterns into Excel custom number formats.
This issue exists si that I can contribute what I end up with back to POI.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
DO NOT REPLY [Bug 52928] Provide utility methods to convert Java
Date formats into Excel date formats
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52928
--- Comment #1 from Jim Talbut <ji...@spudsoft.co.uk> 2012-03-16 12:14:00 UTC ---
Created attachment 28479
--> https://issues.apache.org/bugzilla/attachment.cgi?id=28479
Example Excel document generated from the proposed code
This is a zip file containing a number of Excel files each of which
demonstrates a particular Date/Time format for all available locales for the
Sun Windows JVM.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
DO NOT REPLY [Bug 52928] Provide utility methods to convert Java
Date formats into Excel date formats
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52928
Yegor Kozlov <ye...@dinom.ru> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #3 from Yegor Kozlov <ye...@dinom.ru> 2012-03-17 12:39:35 UTC ---
Very cool, applied in r1301923 with some tweaks, junit included.
The testing is tricky. We should not rely on our eyes , you simply don't see
all the discrepancies if you don't know the locale language.
To simplify testing I added two more columns: column D is the value returned by
java.text.DateFormat and column E is a formula that returns TRUE if Excel
formatted value in column C equals to its Java counterpart in column D.
The formula looks as follows:
TEXT(C6,G6)=D6
where C6 is date, not matter how it is formatted, excel takes the raw double
value.
G6 is the format applied to the cell style, e.g. [$-41C]yyyy-MM-dd;@
and D6 is a string calculated in Java.
We expect that Excel and Java format equally and the formula in all rows will
return TRUE. Unfortunately it is not so, but it is not a bug, rather MS Office
and Java format locales slightly differently. See attached example, not
matched rows are marked in red.
For the future, please consider enhancing this utility to support
bi-directional conversion:
1. from java.text.DateFormat to Excel date pattern
and the other way around
2. from excel date pattern to java.text.DateFormat
The second option is important to properly format excel date cell as a string.
Regards,
Yegor
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
DO NOT REPLY [Bug 52928] Provide utility methods to convert Java
Date formats into Excel date formats
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52928
--- Comment #4 from Yegor Kozlov <ye...@dinom.ru> 2012-03-17 13:03:55 UTC ---
Created attachment 28483
--> https://issues.apache.org/bugzilla/attachment.cgi?id=28483
sample output with highlited diffs
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
DO NOT REPLY [Bug 52928] Provide utility methods to convert Java
Date formats into Excel date formats
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52928
--- Comment #2 from Jim Talbut <ji...@spudsoft.co.uk> 2012-03-16 12:15:33 UTC ---
Created attachment 28480
--> https://issues.apache.org/bugzilla/attachment.cgi?id=28480
Class file to convert from Java DateFormat to Excel custom number format
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org