[英]java.lang.IllegalStateException: You can define up to 4000 styles in a .xls workbook at org.apache.poi.hssf.usermodel issue
java.lang.IllegalStateException: The maximum number of cell styles was exceeded. java.lang.IllegalStateException:超出了单元格样式的最大数量。 You can define up to 4000 styles in a .xls workbook at org.apache.poi.hssf.usermodel.HSSFWorkbook.createCellStyle(HSSFWorkbook.java:1144) 2017-05-25 14:31:19 INFO Main:68 - PrepareEmailMsg at org.apache.poi.hssf.usermodel.HSSFWorkbook.createCellStyle(HSSFWorkbook.java:88) at org.apache.poi.ss.util.CellUtil.setCellStyleProperty(CellUtil.java:204) at org.apache.poi.ss.util.CellUtil.setFont(CellUtil.java:168). 您可以在org.apache.poi.hssf.usermodel.HSSFWorkbook.createCellStyle(HSSFWorkbook.java:1144)的.xls工作簿中最多定义4000种样式2017-05-25 14:31:19 INFO Main:68-PrepareEmailMsg at org.apache.poi.ss的org.apache.poi.ss.util.CellUtil.setCellStyleProperty(CellUtil.java:204)的org.apache.poi.hssf.usermodel.HSSFWorkbook.createCellStyle(HSSFWorkbook.java:88) util.CellUtil.setFont(CellUtil.java:168)。 How to resolve this issue. 如何解决这个问题。 CreateCellSty is avoided in this code.? 此代码中避免了CreateCellSty。
for(int i=0; i<sheet.getLastRowNum();i++)
{
if(sheet.getRow(i)!=null)
{
System.out.println("removed");
sheet.removeRow(sheet.getRow(i));
}
else{
sheet.shiftRows(2, rows, 3);
System.out.println("shift");
}
}
Is this code is valid to remove data from A row of a sheet,Because after Completing of sheet this show above issue.? 此代码是否有效以从工作表的A行中删除数据,因为完成工作表后会显示此问题。 Please provide Proper Suggestion. 请提供适当的建议。
Your problem should be coming from this code 您的问题应该来自此代码
else{
sheet.shiftRows(2, rows, 3);
System.out.println("shift");
}
Have you tried without it ? 你尝试过没有它吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.