Skip to content

Commit

Permalink
Merge branch 'master' into feature/datetime-correction
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukasz Arciszewski committed May 17, 2024
2 parents 1703f4d + 5cce5e4 commit fb5d1ec
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 23 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: .NET

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
push:
branches:
- master

jobs:
build:
Expand All @@ -16,7 +16,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore
env:
Expand Down
3 changes: 3 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@

---

### 1.32.1
- [New] .NET5^ support image `ReadOnlySpan<byte>`
- [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)
Expand Down
4 changes: 3 additions & 1 deletion docs/README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@

---


### 1.32.1
- [New] .NET5^ support image `ReadOnlySpan<byte>`
- [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)
Expand Down
4 changes: 3 additions & 1 deletion docs/README.zh-Hant.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@

---


### 1.32.1
- [New] .NET5^ support image `ReadOnlySpan<byte>`
- [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)
Expand Down
9 changes: 2 additions & 7 deletions src/MiniExcel/MiniExcelLibs.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net45;netstandard2.0</TargetFrameworks>
<Version>1.32.0</Version>
<TargetFrameworks>net45;netstandard2.0;net6.0;</TargetFrameworks>
<Version>1.32.1</Version>
</PropertyGroup>
<PropertyGroup>
<AssemblyName>MiniExcel</AssemblyName>
Expand Down Expand Up @@ -54,9 +54,4 @@ Todo : https://github.com/mini-software/MiniExcel/projects/1?fullscreen=true</De
<ItemGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="Portable.System.DateTimeOnly">
<Version>8.0.0</Version>
</PackageReference>
</ItemGroup>
</Project>
10 changes: 5 additions & 5 deletions src/MiniExcel/OpenXml/ExcelOpenXmlSheetReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public IEnumerable<IDictionary<string, object>> Query(bool useHeaderRow, string
// 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)
{
Expand All @@ -73,14 +73,14 @@ public IEnumerable<IDictionary<string, object>> Query(bool useHeaderRow, string
{
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 [email protected]
// 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();
Expand Down
2 changes: 1 addition & 1 deletion src/MiniExcel/OpenXml/ExcelOpenXmlSheetWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ private Tuple<string, string, string> GetCellValue(int rowIndex, int cellIndex,
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)
Expand Down
4 changes: 2 additions & 2 deletions src/MiniExcel/Utils/ImageHelper.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace MiniExcelLibs.Utils
{
using System;
internal class ImageHelper
{
public enum ImageFormat
Expand Down Expand Up @@ -47,8 +48,7 @@ public static ImageFormat GetImageFormat(byte[] bytes)
return ImageFormat.unknown;
}
#endif

#if NET5_0
#if NET5_0_OR_GREATER
public static ImageFormat GetImageFormat(ReadOnlySpan<byte> bytes)
{
ReadOnlySpan<byte> bmp = stackalloc byte[] { (byte)'B', (byte)'M' }; // BMP
Expand Down
12 changes: 10 additions & 2 deletions tests/MiniExcelTests/MiniExcelTests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net5.0;</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>

<IsPackable>false</IsPackable>
<AssemblyOriginatorKeyFile>miniexcel.snk</AssemblyOriginatorKeyFile>
Expand All @@ -26,11 +26,19 @@
<PackageReference Include="NPOI" Version="2.7.0" />
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.115.5" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="5.0.0" />


<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<!--<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</PackageReference>-->
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit fb5d1ec

Please sign in to comment.