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

This commit is contained in:
RuoYi 2024-03-22 16:44:54 +08:00
parent 11320b2e13
commit 86ca404dbf
1 changed files with 3 additions and 0 deletions

View File

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