pjfanning opened a new pull request, #1608:
URL: https://github.com/apache/poi/pull/1608

   This is #1597 rebased onto trunk, with one more commit that fixes what a 
review of it found. The first three commits are the ones of #1597, unchanged 
apart from the rebase; it supersedes that PR.
   
   What #1597 does:
   
   - **A leading decimal point is the decimal point.** `.00` shows 0.5 as `.50` 
and 12.5 as `12.50`, as `#.00` does. It was read as text, so 0.5 was shown as 
`.01`.
   - **An empty section shows nothing.** `0;-0;;@` hides zeros, `0;-0;` does 
the same and `;;;` hides every value. An empty section was skipped, so the next 
one took its place, and `;;;` failed with an `IndexOutOfBoundsException`.
   
   What the last commit changes:
   
   - **Rebase onto #1604.** The empty format and sections with only a color or 
a condition are handled on trunk since #1604. The duplicates here are removed: 
`NO_FORMAT_TEXT`, the fallback for a format without sections and a second 
`testEmptyFormat`, with which the test class did not compile after the rebase.
   - **`. eur 0` failed to parse.** An `e` between a leading point and the 
first digit placeholder was taken as an exponent and failed with a 
`StringIndexOutOfBoundsException`. It is text again, as before #1597. A bare 
`e` after a digit placeholder is still rejected, as it was.
   - **`@;` and `0;@;` keep their text section.** The separator at the end 
added an empty section after the text section, so `@` became a number section. 
A separator after the text section no longer adds a section, which is what 
`CellFormat` did before. I have not checked this one against Excel.
   - **`DataFormatter` and formats that end with `;`.** Every such format was 
sent to `CellFormat`, for all values. Now only a negative value is, as that is 
the value the empty section hides, and only when the `;` is a separator (not 
`\;` `_;` `*;` or in quotes). The other values are formatted as they were 
before, and a format added with `addFormat` for such a format string is used 
again. Formats that start with `;` still go to `CellFormat`.
   - **Fractions with text before the denominator.** The check for a fraction 
wanted the denominator directly after the `/`, so in `. ?/\ ?` the point became 
a decimal point and the fraction was dropped. A denominator anywhere after the 
`/` now counts.
   - **`0.00/` failed.** A `/` in a format with a decimal point is text, but it 
was still counted as a digit after the point, which failed with a 
`StringIndexOutOfBoundsException`. This was already so on trunk; a leading 
point made it reachable for `.00/` too.
   - **`CellNumberPartHandler()`** is public again. The class is `@Internal`, 
but the no-argument constructor was there before; it leaves a leading point as 
text, as it always did.
   
   All with tests in `TestCellFormat` and `TestDataFormatter`.
   
   🤖 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]

Reply via email to