Выгрузка маршрутов: исполнители идут сразу под согласующими без шапки и пустой строки
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -71,6 +71,8 @@ public static class RouteExportWorkbook
|
|||||||
var rowIndex = 0;
|
var rowIndex = 0;
|
||||||
foreach (var section in sheetData.Sections)
|
foreach (var section in sheetData.Sections)
|
||||||
{
|
{
|
||||||
|
if (rowIndex > 0) rowIndex++; // пустая строка только между маршрутами
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(section.Title))
|
if (!string.IsNullOrWhiteSpace(section.Title))
|
||||||
{
|
{
|
||||||
var titleRow = sheet.CreateRow(rowIndex);
|
var titleRow = sheet.CreateRow(rowIndex);
|
||||||
@@ -81,6 +83,9 @@ public static class RouteExportWorkbook
|
|||||||
rowIndex++;
|
rowIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Шапка колонок — один раз на маршрут: исполнители идут сразу под
|
||||||
|
// согласующими, их отделяет только строка-подпись.
|
||||||
|
var firstGroup = true;
|
||||||
foreach (var group in section.Groups)
|
foreach (var group in section.Groups)
|
||||||
{
|
{
|
||||||
var captionRow = sheet.CreateRow(rowIndex);
|
var captionRow = sheet.CreateRow(rowIndex);
|
||||||
@@ -90,14 +95,19 @@ public static class RouteExportWorkbook
|
|||||||
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, Columns.Length - 1));
|
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, Columns.Length - 1));
|
||||||
rowIndex++;
|
rowIndex++;
|
||||||
|
|
||||||
var header = sheet.CreateRow(rowIndex++);
|
if (firstGroup)
|
||||||
for (var i = 0; i < Columns.Length; i++)
|
|
||||||
{
|
{
|
||||||
var cell = header.CreateCell(i);
|
var header = sheet.CreateRow(rowIndex++);
|
||||||
cell.SetCellValue(Columns[i].Title);
|
for (var i = 0; i < Columns.Length; i++)
|
||||||
cell.CellStyle = headerStyle;
|
{
|
||||||
|
var cell = header.CreateCell(i);
|
||||||
|
cell.SetCellValue(Columns[i].Title);
|
||||||
|
cell.CellStyle = headerStyle;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
firstGroup = false;
|
||||||
|
|
||||||
foreach (var row in group.Rows)
|
foreach (var row in group.Rows)
|
||||||
{
|
{
|
||||||
var excelRow = sheet.CreateRow(rowIndex++);
|
var excelRow = sheet.CreateRow(rowIndex++);
|
||||||
@@ -110,8 +120,6 @@ public static class RouteExportWorkbook
|
|||||||
WriteText(excelRow, 4, row.Condition, cellStyle);
|
WriteText(excelRow, 4, row.Condition, cellStyle);
|
||||||
WriteText(excelRow, 5, row.Comment, cellStyle);
|
WriteText(excelRow, 5, row.Comment, cellStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
rowIndex++; // пустая строка между таблицами
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user