POI导出excel报错:The maximum number of cell styles was exceeded. You can define up to 4000 styles in a .xls workbook

 

java.lang.IllegalStateException: The maximum number of cell styles was exceeded. You can define up to 4000 styles in a .xls workbook
at org.apache.poi.hssf.usermodel.HSSFWorkbook.createCellStyle(HSSFWorkbook.java:1262) ~[poi-4.1.2.jar:4.1.2]

 

原因是由于创建了太多的 cell styles,所以一般把cellstyle设置放到循环外面

 

posted @ 2022-03-23 15:39  yvioo  阅读(1208)  评论(0编辑  收藏  举报