第一次使用POI,出现这个问题,看到有其他猿也遇到过,不知道怎么处理,所以记录一下~

sheet.getRow(rowIndex);通过sheet获取指定行,rowIndex代表第几行

用rowIndex行,需要判断该row是否为null,为null就是该row不存在,需要创建该行才能使用。

Row row = sheet.getRow(rowIndex);
if (row == null) {
  row = sheet.createRow(rowIndex);
}

 追:

后面碰到的cell为null,也是同样解决的



相关文章:

  • 2021-06-22
  • 2021-07-27
  • 2022-01-26
  • 2022-01-31
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-28
相关资源
相似解决方案