Bug 68245 - Unable to autosize columns since 5.2.4
Summary: Unable to autosize columns since 5.2.4
Status: RESOLVED DUPLICATE of bug 68094
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on: 68094
Blocks:
  Show dependency tree
 
Reported: 2023-11-28 10:25 UTC by keilhofer
Modified: 2024-02-26 07:11 UTC (History)
0 users



Attachments
sample project (71.17 KB, application/x-zip-compressed)
2023-11-28 11:11 UTC, keilhofer
Details
sample project V2 with screenshots (81.89 KB, application/x-zip-compressed)
2024-02-26 05:53 UTC, keilhofer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description keilhofer 2023-11-28 10:25:31 UTC
I'm using 

> for (short i = 0; i < Math.max(rowZero.getLastCellNum(), 0); i++) 
>   sheet.autoSizeColumn(i);

on a XSSF Sheet to autosize all columns.
This works perfectly with poi up to version 5.2.3.

In version 5.2.4 and 5.2.5 the columns are not autosized in the resulting Excel.

Do I have to add some code since 5.2.4 in order to get this working?
Comment 1 PJ Fanning 2023-11-28 10:58:36 UTC
68094 is the most recent change
Comment 2 keilhofer 2023-11-28 11:11:17 UTC
Created attachment 39408 [details]
sample project

Set version in gradle.properties to 5.2.3 => it works. See File ExcelExport.xlsx after running the testcase.
Set it to 5.2.4 or 5.2.5 => autosizing fails
Comment 3 Dominik Stadler 2024-02-25 19:29:12 UTC
I tried to reproduce this but could not see any difference between 5.2.3 and 5.2.5 when using LibreOffice to display the resulting file.

Maybe there is some other change locally for you which affects this? 

Maybe some font-installation issue?
Comment 4 keilhofer 2024-02-26 05:53:08 UTC
Created attachment 39602 [details]
sample project V2 with screenshots

I added v2 of the project. I updated all other dependencies.
Added two screenshots under src/main/resources
Also added two Excels under src/main/test

If I change poiOoxmlVersion in gradle.properties to 5.2.5 the error occurs:
## set to 5.2.3 in order to work!!
poiOoxmlVersion=5.2.5

with 5.2.3 autosizing works fine.

No other changes on the computer between the changes.

I open the Excel with Microsoft Excel, not with OpenOffice...

Maybe that is the problem?
Comment 5 Dominik Stadler 2024-02-26 07:11:38 UTC
Thanks for the updated information, you are right, Excel shows the columns too small, while LibreOffice displays it properly (also on Windows).

We are discussing some changes between in 5.2.3/4 -> 5.2.5 at bug #68094, hopefully it will also cover this one.

*** This bug has been marked as a duplicate of bug 68094 ***