sheet.getRow (rowIndex); export excel as null_POI

The first time you use the POI, the emergence of this issue, see other apes have also experienced, do not know how to deal with, so the record about ~

sheet.getRow (rowIndex) ; Gets the specified row by sheet, rowIndex represents the first few lines 

with rowIndex line, you need to determine whether the row needs to be created in order to use that line is null, null is that the row does not exist.

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

 



Guess you like

Origin www.cnblogs.com/sunchunmei/p/12085135.html