pjfanning opened a new pull request, #1404:
URL: https://github.com/apache/poi/pull/1404
A follow-up to #1398. `TestDataFormatterAgainstExcel` now matches Excel for
543 of its 569 cases, up from 429. Its known-failures lists are reduced to
match.
## Fixes
- **Single-section conditional formats** such as `[<10]#" Wow"` and
`[>=-10]#" Big"`:
- They're now formatted by `CellFormat`. Before, the condition was ignored
and the text dropped, and only formats with a `;` went to `CellFormat`.
- The condition pattern now also recognises `<>` and negative values.
- When the condition doesn't hold, Excel shows General, and so does
`CellFormat`.
- **`General` with very small numbers:** below 1E-9 they're shown in
scientific notation (`1.1E-10`). Excel shows `1E-9` as `0.000000001`, but
`1.1E-10` in scientific. The old threshold of `<= 1E-10` showed `1.1E-10` as
`0.0000000001`.
- **Decimal point with no digits after it:** it's still shown, so `#,##.#`
gives 1234567 as `1,234,567.`, as in Excel
(`DecimalFormat.setDecimalSeparatorAlwaysShown`).
- **`?` digit placeholders** outside fractions show a space for each missing
digit:
- Leading spaces include the grouping separators the missing digits would
have had: `?,?????????` gives 1234567 as ` 1,234,567`.
- Trailing `?` decimals pad on the right: `|?.??|` gives 1.1 as `|1.1 |`.
- Before, these formats weren't recognised as number formats at all.
- **Several `%` signs:** each one multiplies by 100, so `0,0.00%%` gives
123.45 as `1,234,500.00%%`. `DecimalFormat` only allows one `%`, so they're
quoted and a multiplier is set instead.
- **Fractions with text around the `/`**, such as `|#_#=/=#|`, are formatted
by `CellFormat`. These were not recognised as fractions before.
## Still known failures
- **Text in fractions** (`|#\:#/#|`, `|#_#/#|`, …): Excel shows the text,
e.g. `|23:3/4|`, but `TestDataFormatter.testFractions` asserts that text in a
fraction is stripped (`#"FRED" #/#` gives `321 1/3`). Changing that needs a
decision, so these are left as they are.
- **Rounding to whole seconds** (`hh:mm:ss` with 37.638 s shows `38` in
Excel): this one is still pending, because existing tests expect truncation.
## Tests
Passing locally:
- `poi`: `TestDataFormatter`, `TestFractionFormat`, `TestDateUtil`,
`TestExcelStyleDateFormatter`, `TestHSSFDataFormat`, `TestHSSFDataFormatter`,
`TestHSSFDateUtil`, `TestBugs`, `TestTime`, `org.apache.poi.ss.format.*`,
`org.apache.poi.hssf.extractor.*`
- `poi-ooxml`: `TestDataFormatterAgainstExcel`, `TestXSSFDataFormat`,
`TestXSSFCell`, `TestXSSFWorkbook`, `TestXSSFWithLocale`, `TestSXSSFWorkbook`,
`TestXSSFReader`, `TestXSSFBReader`, `TestXSSFBSheetParser`,
`org.apache.poi.xssf.extractor.*`, `org.apache.poi.ss.tests.format.*`
`TestXSSFBugs` passes apart from `stackoverflow23114397`, a font-metric
width check that also fails locally on trunk.
🤖 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]