码迷,mamicode.com
首页 > Windows程序 > 详细

sheet.getRow(rowIndex);为null_POI导出excel

时间:2019-12-23 19:00:09      阅读:302      评论:0      收藏:0      [点我收藏+]

标签:color   class   使用   div   需要   creat   记录   出现   style   

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

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

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

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

 



sheet.getRow(rowIndex);为null_POI导出excel

标签:color   class   使用   div   需要   creat   记录   出现   style   

原文地址:https://www.cnblogs.com/sunchunmei/p/12085135.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!