Bug 68031

Summary: The inconsistency about default column style
Product: POI Reporter: Nina <nina81331>
Component: XSSFAssignee: POI Developers List <dev>
Status: NEW ---    
Severity: major    
Priority: P2    
Version: 5.2.3-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: All   
Bug Depends on: 56525, 66679    
Bug Blocks:    
Attachments: Test code&Template&Result

Description Nina 2023-10-31 09:35:53 UTC
Created attachment 39325 [details]
Test code&Template&Result

I found some problems after I upgraded the version from 4.1.2 to 5.2.4.

What I do is reading a xlsx file as template to do something then output it just like the Test.java attached. Generally I will look through all cells but here just read the null cells (A1-A4 & B1-B4) to reproduce the issue.

The expected result is the file TestColumnStyleResult(4.1.2).xlsx but actual one is TestColumnStyleResult(5.2.4).xlsx.

The problems are below:

1. The empty cells filled with a default column style which are different with the behavior before.

About the column default style, I saw the same question in Bug 56525. It seems I will always get a default cell style instead of null by the codes but it doesn't conform to the API doc. I don't know either the codes or the doc descrition is wrong.

2. The default column style is only used on A column not on all null cells.

Just like the result file, both A1-A4 & B1-B4 are null cells but the default column style only happened on the cells of A column. The problem happened in the XSSFRow.onDocumentWrite() method when outputing. The order is to apply cell style first then the for loop will break if compare result is not equal. I'm not sure if the order is correct but it caused the inconsistency in this case.

I want to know if these 2 problems are bug and how should I do to get the same result as version 4.1.2.

p.s. It seems be similar with Bug 66679 but not identical.