using System.Linq; using AsbCloudApp.Data.AutogeneratedDailyReport; using ClosedXML.Excel; namespace AsbCloudInfrastructure.Services.AutoGeneratedDailyReports.AutogeneratedDailyReportBlocks; public class SubsystemExcelBlockWriter : IExcelBlockWriter { private const int rowHeaderBlock = 13; private const int columnName = 1; private const int columnKUsage = 2; private const int columnDepth = 3; private const int columnUsedTimeHours = 4; public void Write(IXLWorksheet sheet, AutoGeneratedDailyReportDto report) { var i = 1; foreach( var subsystem in report.Subsystems ) { var row = sheet.Row(i++ + rowHeaderBlock); row.Cell(columnName).Value = subsystem.Name; row.Cell(columnKUsage).Value = subsystem.KUsage; row.Cell(columnDepth).Value = subsystem.Depth; row.Cell(columnUsedTimeHours).Value = subsystem.UsedTimeHours; } } }