浏览代码

1.增加为空判断。

zhengqiang 5 年之前
父节点
当前提交
7d5970aa8f
共有 1 个文件被更改,包括 14 次插入13 次删除
  1. 14 13
      picc-common/src/main/java/com/jpsoft/picc/modules/common/utils/POIUtils.java

+ 14 - 13
picc-common/src/main/java/com/jpsoft/picc/modules/common/utils/POIUtils.java

@@ -402,21 +402,22 @@ public class POIUtils {
         while(srcRowIndex<= rowNum){
             Row dataRow1 = srcSheet.getRow(srcRowIndex);
 
-            Cell cell = dataRow1.getCell(validateColIndex);
-
-            if (cell!=null && StringUtils.isNotEmpty(cell.getStringCellValue())){
-                Row dataRow2 = destSheet.createRow(destRowIndex);
-
-                for (int i=0;i<dataRow1.getLastCellNum();i++){
-                    if (dataRow1.getCell(i)!=null) {
-                        dataRow2.createCell(i).setCellValue((String)getCellValue(0,srcRowIndex,i));
-                    }
-                    else{
-                        break;
+            if(dataRow1!=null) {
+                Cell cell = dataRow1.getCell(validateColIndex);
+
+                if (cell != null && StringUtils.isNotEmpty(cell.getStringCellValue())) {
+                    Row dataRow2 = destSheet.createRow(destRowIndex);
+
+                    for (int i = 0; i < dataRow1.getLastCellNum(); i++) {
+                        if (dataRow1.getCell(i) != null) {
+                            dataRow2.createCell(i).setCellValue((String) getCellValue(0, srcRowIndex, i));
+                        } else {
+                            break;
+                        }
                     }
-                }
 
-                destRowIndex++;
+                    destRowIndex++;
+                }
             }
 
             srcRowIndex++;