pjfanning opened a new pull request, #1422: URL: https://github.com/apache/poi/pull/1422
Fixes [bug 62242](https://bz.apache.org/bugzilla/show_bug.cgi?id=62242) (and its duplicate [59433](https://bz.apache.org/bugzilla/show_bug.cgi?id=59433)). `CellNumberFormatter.writeInteger` always wrote the units digit, so an integer part of zero was shown even by a `?` or `#` placeholder: | Format | Value | Before | After | |---|---|---|---| | `??` | 0 | ` 0` | two spaces | | `_ * #,##0.00_ ;_ * \-#,##0.00_ ;_ * "-"??_ ;_ @_` | 0 | ` - 0 ` | ` - ` | | `_-[$£-809]* "-"??_-` | 0 | ` £ - 0 ` | ` £ - ` | | `#` | 0 | `0` | (empty) | | `#.00` | 0.5 | `0.50` | `.50` | An integer part of zero is now insignificant like any other leading zero: `?` shows a space, `#` shows nothing, and `0` still shows the 0. Microsoft's docs say `#` doesn't display insignificant zeros, and `?` adds spaces for them. Fractions and scientific notation keep the 0. Excel shows it there: `TestDataFormatterAgainstExcel` has 30 fraction cases at 0, such as `|#\:#/#|` showing `|0|`, and those fail if the change applies to fractions too. That is probably what made the 2018 PR (#106) fail other tests. The three 62242 tests are moved from `TestUnfixedBugs` to `TestCellFormat`. The commented-out zero assertions in `testAccountingFormats` (the "incorrect bonus 0" TODO) are enabled; their expected strings left out the trailing space from `_-`. Tests: the `ss.format` tests, `TestDataFormatter` and `TestHSSFDataFormatter` pass. In poi-ooxml, `TestDataFormatterAgainstExcel` (569 cases) and `TestCellFormatPart` pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
