diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportMakerExcel.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportMakerExcel.cs index d5e9728a..a54a8e90 100644 --- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportMakerExcel.cs +++ b/AsbCloudInfrastructure/Services/DailyReport/DailyReportMakerExcel.cs @@ -44,7 +44,9 @@ namespace AsbCloudInfrastructure.Services.DailyReport timeBalance.Draw(sheet); blockDimensionless.Draw(sheet); blockSaub.Draw(sheet); - blockSign.Draw(sheet); + blockSign.Draw(sheet); + //sheet.Columns().AdjustToContents(); // Adjust column width + sheet.Rows().AdjustToContents(); } } } diff --git a/AsbCloudInfrastructure/Services/DailyReport/XLExtentions.cs b/AsbCloudInfrastructure/Services/DailyReport/XLExtentions.cs index ff079b14..5297b0e1 100644 --- a/AsbCloudInfrastructure/Services/DailyReport/XLExtentions.cs +++ b/AsbCloudInfrastructure/Services/DailyReport/XLExtentions.cs @@ -10,12 +10,12 @@ namespace AsbCloudInfrastructure.Services.DailyReport var mergedRange = range.Merge(); mergedRange.FirstCell()._SetValue(value); var colWidth = mergedRange.FirstCell().WorksheetColumn().Width; - var maxCharsToWrap = colWidth / (0.05d * mergedRange.FirstCell().Style.Font.FontSize); + var maxCharsToWrap = colWidth / (0.1d * mergedRange.FirstCell().Style.Font.FontSize); if (value is string valueString && valueString.Length > maxCharsToWrap) { var row = mergedRange.FirstCell().WorksheetRow(); var baseHeight = row.Height; - row.Height = 0.45d * baseHeight * Math.Ceiling(1d + valueString.Length / maxCharsToWrap); + row.Height = 0.5d * baseHeight * Math.Ceiling(1d + valueString.Length / maxCharsToWrap); } mergedRange.Style.SetAllBorders() .Alignment.SetWrapText(true); @@ -59,7 +59,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport { var row = cell.WorksheetRow(); var baseHeight = row.Height; - row.Height = 0.52d * baseHeight * Math.Ceiling(1d + value.Length / maxCharsToWrap); + row.Height = 0.5d * baseHeight * Math.Ceiling(1d + value.Length / maxCharsToWrap); } } @@ -80,7 +80,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport { var row = cell.WorksheetRow(); var baseHeight = row.Height; - row.Height = 0.52d * baseHeight * Math.Ceiling(1d + value.Length / maxCharsToWrap); + row.Height = 0.5d * baseHeight * Math.Ceiling(1d + value.Length / maxCharsToWrap); } }