解决后续合并值不一致也误合并问题

This commit is contained in:
Simple 2023-12-08 12:04:06 +08:00
parent 3e85520c0f
commit e9bf70cb34

View File

@ -104,6 +104,12 @@ public class CellMergeStrategy extends AbstractMergeStrategy {
cellList.add(new CellRangeAddress(repeatCell.getCurrent() + rowIndex, i + rowIndex, colNum, colNum));
}
}
} else {
if (!cellValue.equals(val)) {
if (i - repeatCell.getCurrent() > 1) {
cellList.add(new CellRangeAddress(repeatCell.getCurrent() + rowIndex, i + rowIndex - 1, colNum, colNum));
}
map.put(field, new RepeatCell(val, i));
} else {
RepeatCell firstCell = map.get(mergeFields.get(0));
if (repeatCell.getCurrent() != firstCell.getCurrent()) {
@ -120,6 +126,7 @@ public class CellMergeStrategy extends AbstractMergeStrategy {
}
}
}
}
return cellList;
}