修改文本单元格所在列的单元格格式为文本
This commit is contained in:
parent
63cfdadc0c
commit
8ebb0e0834
|
|
@ -452,6 +452,15 @@ public class ExcelUtil<T>
|
|||
cell.setCellValue(attr.name());
|
||||
setDataValidation(attr, row, column);
|
||||
cell.setCellStyle(styles.get("header"));
|
||||
if (ColumnType.STRING == attr.cellType())
|
||||
{
|
||||
CellStyle cellStyle = cell.getCellStyle();
|
||||
DataFormat wbDataFormat = wb.createDataFormat();
|
||||
cellStyle.setDataFormat(wbDataFormat.getFormat("TEXT"));
|
||||
} else if (ColumnType.NUMERIC == attr.cellType())
|
||||
{
|
||||
cell.setCellType(CellType.NUMERIC);
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue