Forráskód Böngészése

zdjd 导入作业证1.0

zhangding 3 éve
szülő
commit
fd3c474e08

+ 5 - 2
master/src/main/java/com/ruoyi/project/training/controller/TWorkcertificateController.java

@@ -168,11 +168,14 @@ public class TWorkcertificateController extends BaseController
             try {
                 logger.info("读取行数:" + i);
                 Row row = sheet.getRow(i);
-                int cellNum = row.getPhysicalNumberOfCells();
+             //   int cellNum = row.getPhysicalNumberOfCells();
+                int cellNum = row.getLastCellNum();
                 TWorkcertificate entity = new TWorkcertificate();
                 for (int j = 0; j < cellNum; j++) {
                     Cell cell = row.getCell(j);
-                    cell.setCellType(CellType.STRING);
+                    if (cell == null) {
+                        continue;
+                    }
                     String cellValue = ExcelUtils.getCellValue(cell);
                     logger.info("cellValue:" + cellValue);
                     if (j == 0) {