Index: lams_common/src/java/org/lamsfoundation/lams/util/excel/ExcelUtil.java =================================================================== diff -u -r4f5eca990931a3d98f22aee38ccb79bb8ce9f153 -r5a7e02f11a118499d2f7476f8252ff788d6b6dd1 --- lams_common/src/java/org/lamsfoundation/lams/util/excel/ExcelUtil.java (.../ExcelUtil.java) (revision 4f5eca990931a3d98f22aee38ccb79bb8ce9f153) +++ lams_common/src/java/org/lamsfoundation/lams/util/excel/ExcelUtil.java (.../ExcelUtil.java) (revision 5a7e02f11a118499d2f7476f8252ff788d6b6dd1) @@ -207,7 +207,7 @@ } Sheet sheet = workbook.createSheet(sheetName); - Map columnWidths = fixedColumnWidth == null ? null : new HashMap<>(); + Map columnWidths = fixedColumnWidth == null ? new HashMap<>() : null; // Print title if requested boolean isTitleToBePrinted = displaySheetTitle && StringUtils.isNotBlank(excelSheet.getSheetName()); @@ -247,13 +247,15 @@ sheet.addMergedRegion(mergedCells); } - for (int columnIndex : columnWidths.keySet()) { - // one unit is 1/256 of character width, plus some characters for padding - // maximum is 255 characters - // or just use the declared fixed column width - int columnWidth = fixedColumnWidth == null ? Math.min(255, columnWidths.get(columnIndex) + 4) * 256 - : fixedColumnWidth; - sheet.setColumnWidth(columnIndex, columnWidth); + if (fixedColumnWidth == null) { + for (int columnIndex : columnWidths.keySet()) { + // one unit is 1/256 of character width, plus some characters for padding + // maximum is 255 characters + int columnWidth = Math.min(255, columnWidths.get(columnIndex) + 4) * 256; + sheet.setColumnWidth(columnIndex, columnWidth); + } + } else { + sheet.setDefaultColumnWidth(fixedColumnWidth); } }