Commit Graph

52 Commits

Author SHA1 Message Date
Greg Woolsey d1b92fe2d8 Fix bug #61007
use CellFormat for all format strings containing multiple parts (";" delimited) and update unit test to expect the same values as Excel.  Also added tests for the failing formats.

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1791949 13f79535-47bb-0310-9956-ffa450edef68
2017-04-19 18:10:52 +00:00
Javen O'Neal 9def800cd4 bug 60031: DataFormatter parses months incorrectly when put at the end of date segment. Thanks to Andrzej Witecki
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1779564 13f79535-47bb-0310-9956-ffa450edef68
2017-01-20 05:35:57 +00:00
Javen O'Neal adfd0d7f6c bug 60025: DataFormatter should print booleans as TRUE/FALSE, not true/false
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1760219 13f79535-47bb-0310-9956-ffa450edef68
2016-09-11 03:37:56 +00:00
Dominik Stadler da595c2343 Fix some IntelliJ and Findbugs warnings: StringBuilder, foreach, append(), ...
test-updates

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1753122 13f79535-47bb-0310-9956-ffa450edef68
2016-07-17 21:18:07 +00:00
Javen O'Neal 268c5deeb2 bug 59791: FormulaEvaluator#evaluateFormulaCell(Cell) should return an integer for backwards compatibility
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1751261 13f79535-47bb-0310-9956-ffa450edef68
2016-07-04 12:21:42 +00:00
Javen O'Neal 034d3cfcca bug 59791: getCellType and getCachedFormulaResultType should return an integer for backwards compatibility
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1751256 13f79535-47bb-0310-9956-ffa450edef68
2016-07-04 11:54:20 +00:00
Javen O'Neal d1d6ea97fb bug 59791: convert Cell Type to an enum
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1751237 13f79535-47bb-0310-9956-ffa450edef68
2016-07-04 09:45:46 +00:00
Javen O'Neal 33cf815199 bug 59773: move loop invariants outside of loop or change for loops to for-each loops
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1751131 13f79535-47bb-0310-9956-ffa450edef68
2016-07-03 07:20:47 +00:00
Javen O'Neal 9c19717151 add comments and make the statefulness of localeIsAdapting more obvious.
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1747171 13f79535-47bb-0310-9956-ffa450edef68
2016-06-07 08:54:08 +00:00
Javen O'Neal 914fb92f3c make emulateCSV final, add a single common all-inclusive (private) constructor that all other constructors tree up to and invert the constructors
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1747163 13f79535-47bb-0310-9956-ffa450edef68
2016-06-07 07:39:40 +00:00
Javen O'Neal b84f05a44c replace Obervable with Observable; emulateCsv with emulateCSV
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1747152 13f79535-47bb-0310-9956-ffa450edef68
2016-06-07 06:37:24 +00:00
Javen O'Neal 74be4d4174 bug 59638: patch from Axel Howind, support non-comma number grouping separators (such as German 1.234,57)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1747139 13f79535-47bb-0310-9956-ffa450edef68
2016-06-07 06:18:44 +00:00
Javen O'Neal 808254af89 bug 59383: getFormat should cache data formatter (fix from Nick C), accidentally deleted in bug 58532 r1710407.
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1741114 13f79535-47bb-0310-9956-ffa450edef68
2016-04-26 22:48:02 +00:00
Dominik Stadler bdef6e1c52 Regression in version 3.14-beta1: three or four-part formats with locale id cause exceptions when formatting instead of falling back to other formatting
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1724488 13f79535-47bb-0310-9956-ffa450edef68
2016-01-13 19:46:17 +00:00
Nick Burch 0e7caa5eb1 Bug #55265 - DataFormatter correct support for alternate number grouping characters, eg 1234 + #'##0 = 1'234 not 1,234
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1712605 13f79535-47bb-0310-9956-ffa450edef68
2015-11-04 18:23:17 +00:00
Andreas Beeker acb219fbe1 fixes sonar/findbugs issues
add Date.toString() to forbidden-apis and fix occurrences

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1712181 13f79535-47bb-0310-9956-ffa450edef68
2015-11-02 23:46:57 +00:00
Nick Burch dc947416d4 Mention about Locale definitions in Excel cell data format strings
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1710459 13f79535-47bb-0310-9956-ffa450edef68
2015-10-25 16:13:16 +00:00
Nick Burch e966499ad2 #58532 For Excel cell formats with 3+ parts to them (eg +ve,-ve,0), which
DataFormatter didn't properly support, call out to the alternate CellFormat
 instead for the formatting.
This also allows us to enable some disabled parts of DataFormatter unit tests
We still need to rationalise DataFormatter and CellFormatter though, so we
 only have one set of cell formatting logic...


git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1710399 13f79535-47bb-0310-9956-ffa450edef68
2015-10-24 23:34:47 +00:00
David North efee7bf83f Format numbers more like Excel does
Thanks to Chris Boyle for the patch

https://bz.apache.org/bugzilla/show_bug.cgi?id=58471

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1706971 13f79535-47bb-0310-9956-ffa450edef68
2015-10-06 09:56:26 +00:00
Andreas Beeker aea434a135 forbidden apis fixes - a few DateFormat clean ups ...
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1701888 13f79535-47bb-0310-9956-ffa450edef68
2015-09-09 00:41:03 +00:00
Andreas Beeker aaafb0270d Bug 58326 - Forbidden APIs patches - first set of changes for locale and timezone settings
also includes fixes for
- name shadowing 
- unused deprecated method "getClipRect" in classes extending Graphics2d
- HexDump - replaced intermediate String.format calls with custom padding
- convert testcases to junit4
- closing resources

also tested with an arbitary timezone (PST) and locale (ru)

supresses forbidden apis check for
- LocaleUtil (the only place where Locale.getDefault() and TimeZone.getDefault() should be called)
- Classes using FontMetrics - without the actual text it's difficult to return something sane

Some usage of UTC and Locale.ROOT might be still wrong, e.g. in MapiMessage we don't access the
extended mapi properties, which might contain the timezone

DataFormatter has now a Observable property which need to be observed when custom formats are used
and the Locale changes

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1701688 13f79535-47bb-0310-9956-ffa450edef68
2015-09-07 20:19:50 +00:00
Andreas Beeker 6703c9d3fb forbidden apis fixes
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1700076 13f79535-47bb-0310-9956-ffa450edef68
2015-08-29 21:45:08 +00:00
Nick Burch 77916b9364 #57951 Use BigDecimal in some cases in DataFormatter.formatRawCellContents, to avoid rounding problems on JDK8. Patch from Robert Kish
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1682083 13f79535-47bb-0310-9956-ffa450edef68
2015-05-27 17:15:17 +00:00
Nick Burch 4e3011f70a Fix inconsistent indents
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1682081 13f79535-47bb-0310-9956-ffa450edef68
2015-05-27 17:10:45 +00:00
Nick Burch 6cc94cdae8 Handle date format strings in an iso8601 style format, with a T in them. Fixes bug #54034
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1597038 13f79535-47bb-0310-9956-ffa450edef68
2014-05-23 09:18:16 +00:00
Nick Burch f6a5959788 POI is now on JDK 1.6, so remove 1.5 workaround
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1574049 13f79535-47bb-0310-9956-ffa450edef68
2014-03-04 11:57:44 +00:00
Yegor Kozlov ff79d73725 patch 55731: StringBuilder logic in DataFormatter.cleanFormatForNumber
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1553248 13f79535-47bb-0310-9956-ffa450edef68
2013-12-24 06:02:27 +00:00
Nick Burch 01b276b2f3 Allow formatting of formula error cells, giving back the error string that Excel shows #55729
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1537552 13f79535-47bb-0310-9956-ffa450edef68
2013-10-31 16:53:03 +00:00
Dominik Stadler ed2e2a28bc Bug 54786: Fix missing quoting in date formatting, add a number of unit
tests which verify the new formatting options.

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1514632 13f79535-47bb-0310-9956-ffa450edef68
2013-08-16 09:38:47 +00:00
Nick Burch cb4dfced34 Patch and unit test from Tim Allen from bug #54686 - Improve how DataFormatter handles fractions
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1494986 13f79535-47bb-0310-9956-ffa450edef68
2013-06-20 13:37:26 +00:00
Yegor Kozlov 2365cae199 bugzilla 54137 - improved performance of DataFormatter with Fractions
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1410269 13f79535-47bb-0310-9956-ffa450edef68
2012-11-16 09:46:28 +00:00
Nick Burch 6de1dc574e Fix bug #53389 - Handle formatting General and @ formats even if a locale is prefixed to them
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1349562 13f79535-47bb-0310-9956-ffa450edef68
2012-06-12 22:10:52 +00:00
Nick Burch 6c37e2c672 Correct fraction formatting quick return logic
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1231144 13f79535-47bb-0310-9956-ffa450edef68
2012-01-13 16:03:17 +00:00
Nick Burch 091e464ed4 Bug #52389 - Handle ?/? format fractions as well as #/# ones, and tighten the criteria for triggering fraction formatting matching
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1225093 13f79535-47bb-0310-9956-ffa450edef68
2011-12-28 05:10:24 +00:00
Nick Burch 2af707980e Inspired by bug #52349 - Merge the logic between the TEXT function and DataFormatter
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1221126 13f79535-47bb-0310-9956-ffa450edef68
2011-12-20 07:20:44 +00:00
Nick Burch ffcd5beed5 Fix bug #51115 - Handle DataFormatter escaping of "." in the same way as "-" and "/"
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1098917 13f79535-47bb-0310-9956-ffa450edef68
2011-05-03 05:42:41 +00:00
Yegor Kozlov 1ba16fb3b9 improved DataFormatter, see Bugzilla 50841
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1083173 13f79535-47bb-0310-9956-ffa450edef68
2011-03-19 12:42:01 +00:00
Nick Burch d1aab350fd Fix bug #50756 - When formatting numbers based on their Cell Style, treat GENERAL the same as the more typical General
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1069775 13f79535-47bb-0310-9956-ffa450edef68
2011-02-11 12:31:40 +00:00
Nick Burch 5c3415e09c When formatting numbers with DataFormatter, handle brackets following colours
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@954416 13f79535-47bb-0310-9956-ffa450edef68
2010-06-14 11:45:09 +00:00
Nick Burch ee937dd9d0 Fix bug #49377 - only call DecimalFormat.setRoundingMode on Java 1.6 - it's needed to match excel's rendering of numbers
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@951052 13f79535-47bb-0310-9956-ffa450edef68
2010-06-03 16:20:26 +00:00
Nick Burch 5cd9ac0ccf Fix inspired by bug #48494 - detect and support time formats like HH:MM;HH:MM
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@950665 13f79535-47bb-0310-9956-ffa450edef68
2010-06-02 17:17:42 +00:00
Nick Burch e6879026b5 Fix inspired by bug #48872 - allow DateFormatter.formatRawCellContents to handle 1904 as well as 1900 dates
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@950117 13f79535-47bb-0310-9956-ffa450edef68
2010-06-01 15:31:51 +00:00
Nick Burch fafc079bfe More work inspired by bug #48872 - handle MMMMM and elapsed time formatting rules in DataFormatter
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@950113 13f79535-47bb-0310-9956-ffa450edef68
2010-06-01 15:20:57 +00:00
Nick Burch b303c57d54 More fixes inspired by bug #48872 - handle zero formatting rules, and better color detection in DataFormatter
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@950035 13f79535-47bb-0310-9956-ffa450edef68
2010-06-01 12:12:22 +00:00
Nick Burch 81755dc8d2 Add patch from Jukka from bug #48617 + test - Optionally allow the overriding of the Locale used by DataFormatter to control how the default number and date formats should look
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@903303 13f79535-47bb-0310-9956-ffa450edef68
2010-01-26 16:21:17 +00:00
Josh Micich ed1b4794a0 Bugzilla 47962 - Fixed some potential NPEs. Avoided unnecessary creation of box instances. Applied patch with mods
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@823348 13f79535-47bb-0310-9956-ffa450edef68
2009-10-08 22:29:41 +00:00
Yegor Kozlov bd966f208b removed unnecessary svn:executable flag from files in SVN trunk, see bugzilla 47734
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@814335 13f79535-47bb-0310-9956-ffa450edef68
2009-09-13 16:05:28 +00:00
Josh Micich bae270a565 Changed CRLF to LF in .java base src files. Minor reformatting fixes.
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@776377 13f79535-47bb-0310-9956-ffa450edef68
2009-05-19 16:29:51 +00:00
Nick Burch cf0d23d3de Fix bug #47154 - Handle the cell format @ as the same as General
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@775500 13f79535-47bb-0310-9956-ffa450edef68
2009-05-16 17:39:31 +00:00
Yegor Kozlov af7f84c27e common ss interfaces for drawing, clientacnhor and picture, also some refactoring of common hssf-xssf code
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@713279 13f79535-47bb-0310-9956-ffa450edef68
2008-11-12 07:15:37 +00:00