Hi,
Thanks for providing us details.
I have tested your scenario/case a bit. I used the following sample code for it. I found that the AutoFit Columns operation does not fit the second column (which has wrapped text) correctly. When I auto-fit the second column in MS Excel manually, it sets the column’s width (minimizes it) currently.
e.g
Sample code:
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.getWorksheets().get(0);
Cells cells = worksheet.getCells();
cells.get(“A1”).putValue(“Hello World!”);
String s = “line1 \r\n line2”;
cells.get(“B1”).putValue(s);
Style style = cells.get(“B1”).getStyle();
style.setTextWrapped(true);
cells.get(“B1”).setStyle(style);
worksheet.autoFitColumns();
workbook.save(“f:\files\out1.xlsx”);
I have attached the output file for your reference. Could you check and confirm if this is the issue, you are talking about or something else? After your confirmation, I will log a ticket for it accordingly so nothing should be missed. If you are talking about some other issue, kindly do paste your sample code with template file(s), we will check it soon.
Thank you.