From cc0cdb9ed6b93c534b6c2cbe5e5ff86ca92b175e Mon Sep 17 00:00:00 2001 From: wangbing Date: Fri, 21 Feb 2020 16:05:04 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81Excel=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: 075525f72ca75d41fffa336ab7f6abcd14a4b342 --- .../SpringBoot/java/frame/excel/WExcel.java | 42 ++++++++++--------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/src/main/resources/modules/SpringBoot/java/frame/excel/WExcel.java b/src/main/resources/modules/SpringBoot/java/frame/excel/WExcel.java index 726c62df..5a2f06c8 100644 --- a/src/main/resources/modules/SpringBoot/java/frame/excel/WExcel.java +++ b/src/main/resources/modules/SpringBoot/java/frame/excel/WExcel.java @@ -541,26 +541,28 @@ public class WExcel implements Serializable, Cloneable { WRow wRow = this.rowList.get(i); Row row = sheet.createRow(i + 1); - if (this.rowList.get(i).hasError()) { - // 添加结果 - List errorList = wRow.getErrorList(); - Cell resultCell = row.createCell(0); - resultCell.setCellStyle(new ErrorCellStyle(workbook).getStyle()); - resultCell.setCellValue("错误"); - // 添加错误信息详细说明 - Cell errsCell = row.createCell(1); - errsCell.setCellStyle(new ErrorCellStyle(workbook).getStyle()); - String join = String.join(";", errorList); - errsCell.setCellValue(new XSSFRichTextString(join)); - } else { - // 添加结果 - Cell resultCell = row.createCell(0); - resultCell.setCellStyle(new SuccessCellStyle(workbook).getStyle()); - resultCell.setCellValue("成功"); - // 添加错误信息详细说明 - Cell errsCell = row.createCell(1); - errsCell.setCellStyle(new SuccessCellStyle(workbook).getStyle()); - errsCell.setCellValue(""); + if(offset> 0){ + if (this.rowList.get(i).hasError()) { + // 添加结果 + List errorList = wRow.getErrorList(); + Cell resultCell = row.createCell(0); + resultCell.setCellStyle(new ErrorCellStyle(workbook).getStyle()); + resultCell.setCellValue("错误"); + // 添加错误信息详细说明 + Cell errsCell = row.createCell(1); + errsCell.setCellStyle(new ErrorCellStyle(workbook).getStyle()); + String join = String.join(";", errorList); + errsCell.setCellValue(new XSSFRichTextString(join)); + } else { + // 添加结果 + Cell resultCell = row.createCell(0); + resultCell.setCellStyle(new SuccessCellStyle(workbook).getStyle()); + resultCell.setCellValue("成功"); + // 添加错误信息详细说明 + Cell errsCell = row.createCell(1); + errsCell.setCellStyle(new SuccessCellStyle(workbook).getStyle()); + errsCell.setCellValue(""); + } } for (int j = 0; j < this.columnList.size(); j++) {