fix: 报表导出没有分组时存在空行的情况

This commit is contained in:
写意 2025-07-08 14:36:32 +08:00
parent 1a0b1ad3cc
commit 907e89f973

View File

@ -328,15 +328,18 @@ public class SysReportConfigService : IDynamicApiController, ITransient
int currentRow = 1;
int startCol = 1;
foreach (var group in orderedGroups)
if (orderedGroups.Any(u => u.Any(p => !string.IsNullOrEmpty(p.GroupTitle))))
{
int colCount = group.Count();
worksheet.Cells[currentRow, startCol, currentRow, startCol + colCount - 1].Merge = true;
worksheet.Cells[currentRow, startCol].Value = group.First().GroupTitle;
startCol += colCount;
}
foreach (var group in orderedGroups)
{
int colCount = group.Count();
worksheet.Cells[currentRow, startCol, currentRow, startCol + colCount - 1].Merge = true;
worksheet.Cells[currentRow, startCol].Value = group.First().GroupTitle;
startCol += colCount;
}
currentRow++;
currentRow++;
}
// 处理列标题使用Title或FieldName
var curColIndex = 0;