From 186c04d90a5ed5891ede09bcebc35141b22a652b Mon Sep 17 00:00:00 2001
From: 若依 <yzz_ivy@163.com>
Date: Mon, 10 Oct 2022 09:20:41 +0800
Subject: [PATCH] !595 解决导出时包含空子列表数据异常的问题 Merge pull request !595 from 也曾为你、像超人/N/A
---
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java
index 9d43dad..d687641 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java
@@ -699,6 +699,11 @@
subList = getListCellValue(vo);
subMergedLastRowNum = subMergedLastRowNum + subList.size();
}
+ else
+ {
+ subMergedFirstRowNum++;
+ subMergedLastRowNum++;
+ }
int column = 0;
for (Object[] os : fields)
@@ -808,7 +813,6 @@
if (!headerStyles.containsKey(key))
{
CellStyle style = wb.createCellStyle();
- style = wb.createCellStyle();
style.cloneStyleFrom(styles.get("data"));
style.setAlignment(HorizontalAlignment.CENTER);
style.setVerticalAlignment(VerticalAlignment.CENTER);
@@ -842,7 +846,6 @@
if (!styles.containsKey(key))
{
CellStyle style = wb.createCellStyle();
- style = wb.createCellStyle();
style.setAlignment(excel.align());
style.setVerticalAlignment(VerticalAlignment.CENTER);
style.setBorderRight(BorderStyle.THIN);
@@ -993,7 +996,7 @@
{
// 创建cell
cell = row.createCell(column);
- if (isSubListValue(vo) && attr.needMerge())
+ if (isSubListValue(vo) && getListCellValue(vo).size() > 1 && attr.needMerge())
{
CellRangeAddress cellAddress = new CellRangeAddress(subMergedFirstRowNum, subMergedLastRowNum, column, column);
sheet.addMergedRegion(cellAddress);
--
Gitblit v1.9.2