Pre Merge pull request !457 from simple/dev

This commit is contained in:
simple 2023-12-08 04:10:48 +00:00 committed by Gitee
commit 4b5eff2454
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -93,14 +93,35 @@ public class CellMergeStrategy extends AbstractMergeStrategy {
// 空值跳过不合并 // 空值跳过不合并
continue; continue;
} }
if (!cellValue.equals(val)) { if (j == 0) {
if (i - repeatCell.getCurrent() > 1) { if (!cellValue.equals(val)) {
cellList.add(new CellRangeAddress(repeatCell.getCurrent() + rowIndex, i + rowIndex - 1, colNum, colNum)); 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 if (i == list.size() - 1) {
if (i > repeatCell.getCurrent()) {
cellList.add(new CellRangeAddress(repeatCell.getCurrent() + rowIndex, i + rowIndex, colNum, colNum));
}
} }
map.put(field, new RepeatCell(val, i)); } else {
} else if (i == list.size() - 1) { if (!cellValue.equals(val)) {
if (i > repeatCell.getCurrent()) { if (i - repeatCell.getCurrent() > 1) {
cellList.add(new CellRangeAddress(repeatCell.getCurrent() + rowIndex, i + rowIndex, colNum, colNum)); 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()) {
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 if (i == list.size() - 1) {
if (i > repeatCell.getCurrent()) {
cellList.add(new CellRangeAddress(repeatCell.getCurrent() + rowIndex, i + rowIndex, colNum, colNum));
}
}
} }
} }
} }