Skip to content

feat: Full color support in CellFormat expressions #797

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

thevaadinman
Copy link

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.

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
Copy link
Author

thevaadinman commented Apr 25, 2025

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.

@pjfanning
Copy link
Contributor

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

@thevaadinman
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants