AutosizeColumns on SXSSFWorkbook

前端 未结 3 874
渐次进展
渐次进展 2021-01-07 19:09

Is it possible to autoSizeColumns on a streaming SXSSFWorkbook? I implemented an export functionality to export a list of objects to excel. At first I used the XSSFWorkbook

3条回答
  •  不知归路
    2021-01-07 19:52

    Error: NullPointerException on org.apache.poi.ss.util.SheetUtil.getCellWidth(SheetUtil.java:122)

    Fix: Always set value to Cell as shown below, it throws NullPointerException when there is null in Cell, so set the value as:

    Cell c = row.createCell(i);
    c.setCellValue(text == null ? "" : text );
    

提交回复
热议问题