poi icon indicating copy to clipboard operation
poi copied to clipboard

feat: Full color support in CellFormat expressions

Open thevaadinman opened this issue 7 months ago • 4 comments

This change adds full support for named and indexed color in cell format expressions by adding in the standard color palette to CellFormatPart, from where the formatting information is free to propagate down the stack.

For strict format compatibility, only the 8 basic named colors and 56 indexed colors should be allowed, but this change retains the assumed intended feature of the original code to also support the full set of colors specified in HSSFColor.HSSFColorPredefined. If this is undesirable, the dependency on HSSFColor should be dropped entirely.

This change is required in order to properly support named and indexed colors as part of cell format expressions in products using POI.

thevaadinman avatar Apr 25 '25 11:04 thevaadinman

This submission is based on a change we were required to make in order to add color support to cell format expressions in Vaadin Spreadsheet; the functionality cannot be added to mainline until the corresponding change is in Apache POI mainline.

This pull request is submitted as a conversation opener; any implementation specifics are open to discussion. As it was, the implementation was completely lacking support for indexed color, and the color names in HSSFColorPredefined did not include some of the basic colors, such as magenta or cyan, and the color definitons for what existed were not compatible with expectations of formatting as presented in other products.

thevaadinman avatar Apr 25 '25 11:04 thevaadinman

Thanks @thevaadinman - would you be in a position to extend the test coverage to better test the code in this PR?

pjfanning avatar May 01 '25 13:05 pjfanning

Thanks @thevaadinman - would you be in a position to extend the test coverage to better test the code in this PR?

Yup, I'll get started on that on Monday.

thevaadinman avatar May 02 '25 09:05 thevaadinman

@thevaadinman I'll leave this PR but at the moment, it cannot be merged due to the absence of test coverage.

pjfanning avatar May 27 '25 11:05 pjfanning

@thevaadinman there is conflict in git. Could you rebase?

pjfanning avatar Aug 04 '25 13:08 pjfanning

@thevaadinman there is conflict in git. Could you rebase?

Rebased. Looks good to my eye, but please look over the changes carefully yourself. (edit: turns out Visual Studio Code doesn't do a good job of highlighting these types of errors)

thevaadinman avatar Aug 04 '25 13:08 thevaadinman

Seems I missed something after all.

thevaadinman avatar Aug 04 '25 13:08 thevaadinman

I think I'm done fixing small stuff for now. Compilation and tests run fine on my end.

thevaadinman avatar Aug 04 '25 14:08 thevaadinman

thanks - merged

pjfanning avatar Aug 04 '25 15:08 pjfanning

Thank you!

thevaadinman avatar Aug 04 '25 15:08 thevaadinman

One question from higher up: could you provide a guesstimate as to when this change would be available in a mainline release? Q4/2025 perhaps?

thevaadinman avatar Aug 05 '25 11:08 thevaadinman

One question from higher up: could you provide a guesstimate as to when this change would be available in a mainline release? Q4/2025 perhaps?

no plans for a release at the moment and I won't provide a guess

pjfanning avatar Aug 05 '25 11:08 pjfanning