Fix Row.setRowStyle() not propagating styles to cells in XSSFCell and SXSSFCell#1031
Open
fakhrulsojib wants to merge 2 commits intoapache:trunkfrom
Open
Fix Row.setRowStyle() not propagating styles to cells in XSSFCell and SXSSFCell#1031fakhrulsojib wants to merge 2 commits intoapache:trunkfrom
fakhrulsojib wants to merge 2 commits intoapache:trunkfrom
Conversation
19a9abe to
3e4aac4
Compare
Member
|
@fakhrulsojib don't squash your commits. I can squash them when the PR is merged. |
pjfanning
reviewed
Mar 12, 2026
| import java.io.IOException; | ||
|
|
||
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||
| import static org.junit.jupiter.api.Assertions.*; |
Member
There was a problem hiding this comment.
use explicit imports, not wildcards
Author
There was a problem hiding this comment.
Updated to use explicit imports.
pjfanning
reviewed
Mar 12, 2026
poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFRow.java
Outdated
Show resolved
Hide resolved
Member
|
One test is broken. |
- Add fallback to column and row styles for unstyled HSSF cells - Convert XSSF workbook text fixtures to use try-with-resources - Clean up test formatting and static JUnit assertions
b07c8e5 to
7e69b48
Compare
Author
|
My bad — forgot to build the full project before pushing. Sorry for the two force pushes too. Bad habit :( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Row.setRowStyle()does not propagate styles to cells viaCell.getCellStyle(). This is a regression from POI 3.17 affecting both XSSFCell and SXSSFCell.Bugzilla: https://bz.apache.org/bugzilla/show_bug.cgi?id=69973
Related: Bug 66679, Bug 56011
Root Cause
Three issues in
XSSFCell.getCellStyle()(and mirrored in SXSSFCell):explicit → column— row is never checkedXSSFSheet.getColumnStyle()which converts "no column style" (-1) into the default style (0), so it never returns null — blocking any further fallbackworkbook.write()) only checks column styleChanges
XSSFCell.java / SXSSFCell.java:
ColumnHelper.getColDefaultStyle()directly, return null when no explicit column stylerow.isFormatted()/row.getRowStyle()TestXSSFRow.java / TestSXSSFRow.java:
Test Results