From 88f229359785d64eb8b7725774b61fbeeec74204 Mon Sep 17 00:00:00 2001 From: eugeniy_ivanov Date: Thu, 29 Sep 2022 12:29:10 +0500 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B2=D1=8B=D1=80=D0=B0=D0=B2=D0=BD?= =?UTF-8?q?=D0=B8=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20=D1=8F=D1=87=D0=B5=D0=B5?= =?UTF-8?q?=D0=BA=20=D0=BE=D1=82=D0=BD=D0=BE=D1=81=D0=B8=D1=82=D0=B5=D0=BB?= =?UTF-8?q?=D1=8C=D0=BD=D0=BE=20=D1=81=D0=BE=D0=B4=D0=B5=D1=80=D0=B6=D0=B8?= =?UTF-8?q?=D0=BC=D0=BE=D0=B3=D0=BE=20=D0=B2=20=D1=81=D1=83=D1=82=D0=BE?= =?UTF-8?q?=D1=87=D0=BD=D0=BE=D0=BC=20=D1=80=D0=B0=D0=BF=D0=BE=D1=80=D1=82?= =?UTF-8?q?=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/DailyReport/DailyReportMakerExcel.cs | 4 +++- .../Services/DailyReport/XLExtentions.cs | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) 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); } }