org.apache.poi.hssf.usermodel.HSSFRichTextString cannot be cast to HSSFRichTextString

  EasyPOI
  Java
0
0
0
字数:1078
博主: 勤勇学
发布于: 2024-08-30 14:17:41
原创声明:文章所有权为创作者【原创】所有,未经许可,不得转载!
目录
未发现目录

使用easypoi导出Excel时,设置导出类型为`ExcelType.XSSF`时出现报错

java.lang.ClassCastException: org.apache.poi.hssf.usermodel.HSSFRichTextString cannot be cast to org.apache.poi.xssf.usermodel.XSSFRichTextString
	at org.apache.poi.xssf.usermodel.XSSFCell.setCellValueImpl(XSSFCell.java:425)
	at org.apache.poi.ss.usermodel.CellBase.setCellValue(CellBase.java:325)
	at cn.afterturn.easypoi.excel.export.base.BaseExportService.createStringCell(BaseExportService.java:308)
	at cn.afterturn.easypoi.excel.export.ExcelExportService.createHeaderRow(ExcelExportService.java:96)
	at cn.afterturn.easypoi.excel.export.ExcelExportService.createHeaderAndTitle(ExcelExportService.java:55)
	at cn.afterturn.easypoi.excel.export.ExcelExportService.insertDataToSheet(ExcelExportService.java:238)
	at cn.afterturn.easypoi.excel.export.ExcelExportService.createSheetForMap(ExcelExportService.java:214)
	at cn.afterturn.easypoi.excel.export.ExcelExportService.createSheet(ExcelExportService.java:176)
	at cn.afterturn.easypoi.excel.ExcelExportUtil.exportExcel(ExcelExportUtil.java:156)
...

看看你的easypoi版本,升级到`4.4.0`可解决

目录
未发现目录