使用 POI 创建 Excel 时,我出现了奇怪的行为。
只要我的行数少于约 135 行,我就无法打开 Excel,但有以下异常(exception)情况:
如果我有更多行,我可以毫无问题地打开 Excel。
这是代码,我如何创建工作表:
val out = new ByteArrayOutputStream()
try {
wb = createWorkbook()
wb.writeToOutputStream(out)
out.flush()
out.toByteArray
} finally IOUtils.closeQuietly(out)
我使用Scala包装器spoiwo .
这是代码writeToOutputStream
:
override def writeToOutputStream[T <: OutputStream](stream: T): T =
try {
convertAsXlsx().write(stream)
stream
} finally {
stream.flush()
stream.close()
}
def convertAsXlsx(): XSSFWorkbook = convertWorkbook(workbook)
我在这里添加了一个问题:https://github.com/norbert-radyk/spoiwo/issues/44
最佳答案
关于java - Excel POI : "We found a problem with some content in ... " when the Excel has less than 135 Rows,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55899139/