且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Apache POI getRow()返回null并且.createRow失败

更新时间:2023-02-16 20:07:48

请参阅 SXSSFWorkbook 构造函数的文档,该构造函数将 XSSFWorkbook 作为参数.您不能覆盖或访问模板文件中的初始行.您正在尝试覆盖现有行,而API不支持此行.您的异常消息反映了这一点.

See the documentation for the SXSSFWorkbook constructor that takes the XSSFWorkbook as param. You cannot override or access the initial rows in the template file. You are trying to overwrite an existing row and the API does not support this. Your exception message reflects this.

https://poi.apache.org/apidocs/org/apache/poi/xssf/streaming/SXSSFWorkbook.html#SXSSFWorkbook(org.apache.poi.xssf.usermodel.XSSFWorkbook)

对于您的用例,您可能需要尝试 http://jxls.sourceforge.net .

For your use case, you may want to try http://jxls.sourceforge.net.