From 71a25243384294d9391a5b85b3c9b61a62a6e25d Mon Sep 17 00:00:00 2001 From: ker73rus Date: Wed, 11 Dec 2024 22:24:33 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=BD=D0=B0=20DateOnly=20=D0=B2=20ExcelColumnHeaders?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/ComponentExcelTableWithColumnHeader.cs | 7 ++++++- WinFormSolution/Components/Components.csproj | 2 +- WinFormSolution/WinFormsApp/Program.cs | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/WinFormSolution/Components/ComponentExcelTableWithColumnHeader.cs b/WinFormSolution/Components/ComponentExcelTableWithColumnHeader.cs index 6f0e767..57e3a76 100644 --- a/WinFormSolution/Components/ComponentExcelTableWithColumnHeader.cs +++ b/WinFormSolution/Components/ComponentExcelTableWithColumnHeader.cs @@ -56,7 +56,12 @@ namespace Components var property = data.GetType().GetProperty(headersConfig[rowIndex].propertyName); if (property != null) { - worksheet.Cells[rowIndex + 2, colIndex + 3].Value = property.GetValue(data); + if(property.PropertyType == typeof(DateOnly)) + { + worksheet.Cells[rowIndex + 2, colIndex + 3].Value = property.GetValue(data).ToString(); + } + else + worksheet.Cells[rowIndex + 2, colIndex + 3].Value = property.GetValue(data); } } } diff --git a/WinFormSolution/Components/Components.csproj b/WinFormSolution/Components/Components.csproj index 0ef8996..638cafa 100644 --- a/WinFormSolution/Components/Components.csproj +++ b/WinFormSolution/Components/Components.csproj @@ -7,7 +7,7 @@ enable True ns.potapov - 1.0.7 + 1.1.0 $(VersionPrefix) diff --git a/WinFormSolution/WinFormsApp/Program.cs b/WinFormSolution/WinFormsApp/Program.cs index 3325059..6418cb6 100644 --- a/WinFormSolution/WinFormsApp/Program.cs +++ b/WinFormSolution/WinFormsApp/Program.cs @@ -11,7 +11,7 @@ namespace WinFormsApp // To customize application configuration such as set high DPI settings or default font, // see https://aka.ms/applicationconfiguration. ApplicationConfiguration.Initialize(); - Application.Run(new FormVisual()); + Application.Run(new FormNoVisual()); } } } \ No newline at end of file -- 2.25.1