Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use .NET Core 3.1 SDK
- name: Use .NET Core 6.0 SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.x'
dotnet-version: '6.0.x'
source-url: https://nuget.pkg.github.com/Shane32/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ jobs:
version="${github_ref:10}"
echo version=$version
echo "version=$version" >> $GITHUB_ENV
- name: Use .NET Core 3.1 SDK
- name: Use .NET Core 6.0 SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.x'
dotnet-version: '6.0.x'
source-url: https://api.nuget.org/v3/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.NUGET_AUTH_TOKEN}}
Expand Down
18 changes: 11 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@ jobs:
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Use .NET Core 3.1 LTS SDK
- name: Use .NET Core SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.x'
dotnet-version: |
2.1.x
3.1.x
5.0.x
6.0.x
source-url: https://nuget.pkg.github.com/Shane32/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
Expand All @@ -41,15 +45,15 @@ jobs:
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: danielpalme/ReportGenerator-GitHub-Action@4.7.1
with:
reports: '${{ matrix.os }}.lcov.info'
reports: '${{ matrix.os }}.lcov.net6.0.info'
targetdir: '.'
reporttypes: 'Clover;HtmlSummary'
tag: 'test_${{ github.run_number }}'
- name: Convert coverage report to html
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: danielpalme/ReportGenerator-GitHub-Action@4.7.1
with:
reports: '${{ matrix.os }}.lcov.info'
reports: '${{ matrix.os }}.lcov.net6.0.info'
targetdir: './cloverreport'
reporttypes: 'Html'
tag: 'test_${{ github.run_number }}'
Expand All @@ -58,7 +62,7 @@ jobs:
with:
name: Code coverage artifacts
path: |
${{ matrix.os }}.lcov.info
${{ matrix.os }}.lcov.*
Clover.xml
cloverreport/**
summary.html
Expand All @@ -76,14 +80,14 @@ jobs:
uses: coverallsapp/github-action@v1.1.2
with:
github-token: ${{secrets.GITHUB_TOKEN }}
path-to-lcov: ${{ matrix.os }}.lcov.info
path-to-lcov: ${{ matrix.os }}.lcov.net6.0.info
parallel: true
flag-name: ${{ matrix.os }}
- name: Upload coverage to Codecov
if: ${{ 0 == 1 }}
uses: codecov/codecov-action@v1
with:
file: ${{ matrix.os }}.lcov.info
file: ${{ matrix.os }}.lcov.net6.0.info
flags: unittests # optional
name: codecov-umbrella # optional
fail_ci_if_error: true # optional (default = false)
Expand Down
11 changes: 9 additions & 2 deletions Shane32.ExcelLinq.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30611.23
# Visual Studio Version 17
VisualStudioVersion = 17.3.32811.315
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution items", "Solution items", "{B194B3FB-53C8-4C5D-ABC3-EAB6A52C674D}"
ProjectSection(SolutionItems) = preProject
Expand All @@ -18,6 +18,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shane32.ExcelLinq", "src\Sh
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shane32.ExcelLinq.Tests", "src\Shane32.ExcelLinq.Tests\Shane32.ExcelLinq.Tests.csproj", "{83E2AC89-22B4-438D-92CF-FDA280B63CFD}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Workflows", "Workflows", "{1D410362-3E9F-4ABF-B537-D9980F1452F6}"
ProjectSection(SolutionItems) = preProject
.github\workflows\build.yml = .github\workflows\build.yml
.github\workflows\publish.yml = .github\workflows\publish.yml
.github\workflows\test.yml = .github\workflows\test.yml
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
9 changes: 6 additions & 3 deletions src/Shane32.ExcelLinq.Tests/Shane32.ExcelLinq.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' != 'true'">
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1;net5.0;net6.0;net462;net48</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/Shane32.ExcelLinq.Tests/Writing/OnWriteFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class OnWriteFile
public void Multiple()
{
var package = new ExcelPackage();
package.Compatibility.IsWorksheets1Based = false;
var workbook = package.Workbook;
var mock = new Mock<SampleContext>();
mock.CallBase = true;
Expand Down
12 changes: 8 additions & 4 deletions src/Shane32.ExcelLinq/ExcelContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ protected ExcelContext(string filename) : this()
{
using var stream = new FileStream(filename ?? throw new ArgumentNullException(nameof(filename)), FileMode.Open, FileAccess.Read, FileShare.Read);
using var package = new ExcelPackage(stream);
package.Compatibility.IsWorksheets1Based = false;
_initialized = false;
_sheets = InitializeReadFile(package);
_initialized = true;
Expand All @@ -82,6 +83,7 @@ protected ExcelContext(Stream stream) : this()
{
if (stream == null) throw new ArgumentNullException(nameof(stream));
using var package = new ExcelPackage(stream);
package.Compatibility.IsWorksheets1Based = false;
_initialized = false;
_sheets = InitializeReadFile(package);
_initialized = true;
Expand Down Expand Up @@ -154,12 +156,13 @@ protected virtual List<IList> OnReadFile(ExcelWorkbook workbook)

var sheetArray = Model.Sheets.ToList();
if (Model.IgnoreSheetNames) {
for (var i = 0; i < workbook.Worksheets.Count && i < sheetArray.Count; i++) {
var worksheet = workbook.Worksheets[i];
int i = 0;
foreach (var worksheet in workbook.Worksheets) {
var sheetModel = Model.Sheets[i];
var sheetData = OnReadSheet(worksheet, sheetModel);
if (sheetData == null) throw new InvalidOperationException($"{nameof(OnReadSheet)} returned null for sheet '{sheetModel.Name}'");
sheets[i] = sheetData;
if (sheetData == null)
throw new InvalidOperationException($"{nameof(OnReadSheet)} returned null for sheet '{sheetModel.Name}'");
sheets[i++] = sheetData;
}
}
else {
Expand Down Expand Up @@ -493,6 +496,7 @@ public List<T> GetSheet<T>(string name)
public virtual ExcelPackage SerializeToExcelPackage()
{
var excelPackage = new ExcelPackage();
excelPackage.Compatibility.IsWorksheets1Based = false;
OnWriteFile(excelPackage.Workbook);
return excelPackage;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Shane32.ExcelLinq/Shane32.ExcelLinq.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EPPlus" Version="4.5.3.3" />
<PackageReference Include="EPPlus-LGPL" Version="4.5.3.9" />
</ItemGroup>

<ItemGroup>
Expand Down