From b24b35acad24c33a33039d24f0e1dc9498189d40 Mon Sep 17 00:00:00 2001 From: Wei Lin Date: Thu, 16 May 2024 22:20:03 +0800 Subject: [PATCH] Remove bug with Portable.System.DateTimeOnly and only support DateOnly .NET6^ --- docs/README.md | 1 + docs/README.zh-CN.md | 1 + docs/README.zh-Hant.md | 1 + src/MiniExcel/MiniExcelLibs.csproj | 9 ++------- src/MiniExcel/OpenXml/ExcelOpenXmlSheetReader.cs | 10 +++++----- src/MiniExcel/OpenXml/ExcelOpenXmlSheetWriter.cs | 2 +- 6 files changed, 11 insertions(+), 13 deletions(-) diff --git a/docs/README.md b/docs/README.md index 0a15405..b6a93ae 100644 --- a/docs/README.md +++ b/docs/README.md @@ -24,6 +24,7 @@ ### 1.32.1 - [New] .NET5^ support image `ReadOnlySpan` +- [Bug] Remove bug with Portable.System.DateTimeOnly and only support DateOnly .NET6^ #594 ### 1.32.0 - [New] Using DynamicConfiguration when writing data using DataTable (via @pszybiak) diff --git a/docs/README.zh-CN.md b/docs/README.zh-CN.md index d93ec02..1a06f2b 100644 --- a/docs/README.zh-CN.md +++ b/docs/README.zh-CN.md @@ -27,6 +27,7 @@ ### 1.32.1 - [New] .NET5^ support image `ReadOnlySpan` +- [Bug] Remove bug with Portable.System.DateTimeOnly and only support DateOnly .NET6^ #594 ### 1.32.0 - [New] Using DynamicConfiguration when writing data using DataTable (via @pszybiak) diff --git a/docs/README.zh-Hant.md b/docs/README.zh-Hant.md index d447d9a..213576a 100644 --- a/docs/README.zh-Hant.md +++ b/docs/README.zh-Hant.md @@ -26,6 +26,7 @@ ### 1.32.1 - [New] .NET5^ support image `ReadOnlySpan` +- [Bug] Remove bug with Portable.System.DateTimeOnly and only support DateOnly .NET6^ #594 ### 1.32.0 - [New] Using DynamicConfiguration when writing data using DataTable (via @pszybiak) diff --git a/src/MiniExcel/MiniExcelLibs.csproj b/src/MiniExcel/MiniExcelLibs.csproj index 0bee4ad..9291313 100644 --- a/src/MiniExcel/MiniExcelLibs.csproj +++ b/src/MiniExcel/MiniExcelLibs.csproj @@ -1,7 +1,7 @@  - net45;netstandard2.0 - 1.32.0 + net45;netstandard2.0;net6.0; + 1.32.1 MiniExcel @@ -54,9 +54,4 @@ Todo : https://github.com/mini-software/MiniExcel/projects/1?fullscreen=true - - - 8.0.0 - - diff --git a/src/MiniExcel/OpenXml/ExcelOpenXmlSheetReader.cs b/src/MiniExcel/OpenXml/ExcelOpenXmlSheetReader.cs index cf95e4e..1c78edb 100644 --- a/src/MiniExcel/OpenXml/ExcelOpenXmlSheetReader.cs +++ b/src/MiniExcel/OpenXml/ExcelOpenXmlSheetReader.cs @@ -50,7 +50,7 @@ namespace MiniExcelLibs.OpenXml // if sheets count > 1 need to read xl/_rels/workbook.xml.rels var sheets = _archive.entries.Where(w => w.FullName.StartsWith("xl/worksheets/sheet", StringComparison.OrdinalIgnoreCase) || w.FullName.StartsWith("/xl/worksheets/sheet", StringComparison.OrdinalIgnoreCase) - ); + ).ToArray(); ZipArchiveEntry sheetEntry = null; if (sheetName != null) { @@ -73,14 +73,14 @@ namespace MiniExcelLibs.OpenXml { SetWorkbookRels(_archive.entries); var s = _sheetRecords[0]; -#if NET45 - sheetEntry = sheets.Single(w => w.FullName == $"xl/{s.Path}" || w.FullName == $"/xl/{s.Path}"); -#elif NETSTANDARD2_0_OR_GREATER +//#if NET45 +// sheetEntry = sheets.Single(w => w.FullName == $"xl/{s.Path}" || w.FullName == $"/xl/{s.Path}"); +//#else // fixed by argo@live.ca // s.Path = "/xl/sheets/sheet1.xml" s.FullName = "/xl/sheets/sheet1.xml" sheetEntry = sheets.Single(w => w.FullName == $"xl/{s.Path}" || w.FullName == $"/xl/{s.Path}" || w.FullName.TrimStart('/') == s.Path.TrimStart('/')); -#endif +//#endif } else sheetEntry = sheets.Single(); diff --git a/src/MiniExcel/OpenXml/ExcelOpenXmlSheetWriter.cs b/src/MiniExcel/OpenXml/ExcelOpenXmlSheetWriter.cs index 2552dc2..62ffa5a 100644 --- a/src/MiniExcel/OpenXml/ExcelOpenXmlSheetWriter.cs +++ b/src/MiniExcel/OpenXml/ExcelOpenXmlSheetWriter.cs @@ -574,7 +574,7 @@ namespace MiniExcelLibs.OpenXml cellValue = ((DateTime)value).ToString(columnInfo.ExcelFormat, _configuration.Culture); } } -#if NETSTANDARD2_0_OR_GREATER +#if NET6_0_OR_GREATER else if (type == typeof(DateOnly)) { if (_configuration.Culture != CultureInfo.InvariantCulture)