设置表格头单元格文本形式

This commit is contained in:
RuoYi 2024-03-22 16:44:54 +08:00
parent 11320b2e13
commit 86ca404dbf

View File

@ -848,6 +848,9 @@ public class ExcelUtil<T>
headerFont.setBold(true);
headerFont.setColor(excel.headerColor().index);
style.setFont(headerFont);
// 设置表格头单元格文本形式
DataFormat dataFormat = wb.createDataFormat();
style.setDataFormat(dataFormat.getFormat("@"));
headerStyles.put(key, style);
}
}