Skip to content
This repository was archived by the owner on Nov 14, 2022. It is now read-only.

Commit 3b92722

Browse files
authored
.net 6.0 and linux support added
Embedded pdbs added
2 parents 388a7aa + 3f2df05 commit 3b92722

File tree

188 files changed

+2215
-1400
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

188 files changed

+2215
-1400
lines changed

.github/workflows/dotnet.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ${{ matrix.os }}
1313
strategy:
1414
matrix:
15-
os: [windows-latest]
15+
os: [ubuntu-latest, windows-latest, macos-latest]
1616
steps:
1717
- uses: actions/checkout@v2
1818
- name: Setup .NET
@@ -28,8 +28,8 @@ jobs:
2828

2929
deployRelease:
3030
if: github.ref == 'refs/heads/main'
31-
runs-on: windows-latest
32-
needs: build
31+
runs-on: ubuntu-latest
32+
needs: build
3333
steps:
3434
- uses: actions/checkout@v2
3535
- name: Setup .NET
@@ -42,7 +42,7 @@ jobs:
4242
run: dotnet build --configuration Release --no-restore
4343
- name: NugetPush
4444
run: |
45-
dotnet nuget push .\ClosedXML\bin\Release\*.nupkg --skip-duplicate --api-key ${{secrets.NUGET_TOKEN}} --source https://api.nuget.org/v3/index.json
45+
dotnet nuget push ./ClosedXML/bin/Release/*.nupkg --skip-duplicate --api-key ${{secrets.NUGET_TOKEN}} --source https://api.nuget.org/v3/index.json
4646
- uses: "marvinpinto/action-automatic-releases@latest"
4747
with:
4848
repo_token: "${{ secrets.GITHUB_TOKEN }}"
@@ -55,8 +55,8 @@ jobs:
5555
5656
deployTest:
5757
if: github.ref != 'refs/heads/main'
58-
runs-on: windows-latest
59-
needs: build
58+
runs-on: ubuntu-latest
59+
needs: build
6060
steps:
6161
- uses: actions/checkout@v2
6262
- name: Setup .NET
@@ -70,7 +70,7 @@ jobs:
7070
- name: NugetPush
7171
run: |
7272
ls ./ClosedXML/bin/Release
73-
dotnet nuget push .\ClosedXML\bin\Release\*.nupkg --skip-duplicate --api-key ${{secrets.NUGET_TEST_TOKEN}} --source https://apiint.nugettest.org/v3/index.json
73+
dotnet nuget push ./ClosedXML/bin/Release/*.nupkg --skip-duplicate --api-key ${{secrets.NUGET_TEST_TOKEN}} --source https://apiint.nugettest.org/v3/index.json
7474
- uses: "marvinpinto/action-automatic-releases@latest"
7575
with:
7676
repo_token: "${{ secrets.GITHUB_TOKEN }}"

ClosedXML.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{073C
1818
.github\ISSUE_TEMPLATE.md = .github\ISSUE_TEMPLATE.md
1919
EndProjectSection
2020
EndProject
21+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A120216E-5210-463B-9204-09AF19400FE7}"
22+
ProjectSection(SolutionItems) = preProject
23+
.editorconfig = .editorconfig
24+
testenvironments.json = testenvironments.json
25+
EndProjectSection
26+
EndProject
2127
Global
2228
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2329
Debug|Any CPU = Debug|Any CPU

ClosedXML/ClosedXML.csproj

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
32
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.0;net48</TargetFrameworks>
3+
<TargetFrameworks>netstandard2.0</TargetFrameworks>
54
<LangVersion>8.0</LangVersion>
65
<AssemblyName>ClosedXML</AssemblyName>
76
<PackageId>DocumentPartner.ClosedXML</PackageId>
@@ -16,41 +15,31 @@
1615
<PackageReleaseNotes>$(LAST_COMMIT_MESSAGE)</PackageReleaseNotes>
1716
<Description>ClosedXML is a .NET library for reading, manipulating and writing Excel 2007+ (.xlsx, .xlsm) files. It aims to provide an intuitive and user-friendly interface to dealing with the underlying OpenXML API.</Description>
1817
<Copyright>MIT</Copyright>
18+
<PackageIcon>Product.png</PackageIcon>
1919
<PackageProjectUrl>https://github.com/stesee/ClosedXML</PackageProjectUrl>
20-
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
21-
<NoWarn>$(NoWarn);NU1605;CS1591</NoWarn>
22-
<GenerateDocumentationFile>true</GenerateDocumentationFile>
2320
<Configurations>Debug;Release</Configurations>
2421
<PackageLicenseExpression>MIT</PackageLicenseExpression>
2522
<SignAssembly>true</SignAssembly>
26-
<Optimize Condition="'$(GITHUB_ACTIONS)' == 'true'">true</Optimize>
2723
<AssemblyOriginatorKeyFile>ClosedXML.snk</AssemblyOriginatorKeyFile>
28-
<DefineConstants>$(DefineConstants);RELEASE;STRONGNAME</DefineConstants>
24+
<PackageIcon>Product.png</PackageIcon>
2925
<PublishRepositoryUrl>true</PublishRepositoryUrl>
30-
<EmbedUntrackedSources>true</EmbedUntrackedSources>
31-
<IncludeSymbols>true</IncludeSymbols>
32-
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
26+
<RepositoryUrl>https://github.com/stesee/ClosedXML</RepositoryUrl>
27+
<DebugType>embedded</DebugType>
3328
<PackageReadmeFile>nugetReadme.md</PackageReadmeFile>
3429
<ContinuousIntegrationBuild Condition="'$(GITHUB_ACTIONS)' == 'true'">true</ContinuousIntegrationBuild>
3530
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
31+
<EnableNETAnalyzers>True</EnableNETAnalyzers>
32+
<PackageTags>Excel XLSX OpenXml Windows Linux MacOs</PackageTags>
33+
<PackageRequireLicenseAcceptance>False</PackageRequireLicenseAcceptance>
3634
</PropertyGroup>
37-
38-
<ItemGroup>
39-
<None Include="docs\nugetReadme.md" Pack="true" PackagePath="\" />
40-
</ItemGroup>
41-
42-
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
43-
<DefineConstants>TRACE;_NETSTANDARD_;_NETSTANDARD2_0_</DefineConstants>
35+
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|netstandard2.0|AnyCPU'">
36+
<Optimize>True</Optimize>
4437
</PropertyGroup>
45-
46-
<PropertyGroup Condition=" '$(TargetFramework)' == 'net48' ">
47-
<DefineConstants>$(DefineConstants);_NETFRAMEWORK_;_NET46_</DefineConstants>
38+
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netstandard2.0|AnyCPU'">
4839
</PropertyGroup>
49-
50-
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
51-
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
40+
<ItemGroup>
41+
<None Include="docs\nugetReadme.md" Pack="true" PackagePath="\" />
5242
</ItemGroup>
53-
5443
<ItemGroup>
5544
<PackageReference Include="Fody" Version="6.6.0">
5645
<PrivateAssets>all</PrivateAssets>
@@ -59,14 +48,13 @@
5948
<PackageReference Include="Janitor.Fody" Version="1.9.0" PrivateAssets="all" />
6049
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
6150
</ItemGroup>
62-
6351
<ItemGroup>
64-
<None Include="..\.editorconfig" Link=".editorconfig" />
52+
<None Include="Product.png" Pack="true" PackagePath="\" />
6553
</ItemGroup>
66-
6754
<ItemGroup>
6855
<PackageReference Include="DocumentFormat.OpenXml" Version="2.15.0" />
6956
<PackageReference Include="ExcelNumberFormat" Version="1.1.0" />
70-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
57+
<PackageReference Include="SkiaSharp" Version="2.80.2" />
58+
<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="2.80.2" />
7159
</ItemGroup>
7260
</Project>

ClosedXML/ClosedXML.nuspec

Lines changed: 0 additions & 27 deletions
This file was deleted.

ClosedXML/Excel/CalcEngine/Functions/Text.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ private static object Search(List<Expression> p)
231231
var search = WildcardToRegex(p[0]);
232232
var text = (string)p[1];
233233

234-
if ("" == text) throw new ArgumentException("Invalid input string.");
234+
if (string.IsNullOrEmpty(text)) throw new ArgumentException("Invalid input string.");
235235

236236
var start = 0;
237237
if (p.Count > 2)
@@ -259,8 +259,8 @@ private static object Substitute(List<Expression> p)
259259
var oldText = (string)p[1];
260260
var newText = (string)p[2];
261261

262-
if ("" == text) return "";
263-
if ("" == oldText) return text;
262+
if (string.IsNullOrEmpty(text)) return "";
263+
if (string.IsNullOrEmpty(oldText)) return text;
264264

265265
// if index not supplied, replace all
266266
if (p.Count == 3)

ClosedXML/Excel/Cells/XLCell.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public string InnerText
133133
if (HasRichText)
134134
return _richText.ToString();
135135

136-
return string.Empty == _cellValue ? FormulaA1 : _cellValue;
136+
return string.IsNullOrEmpty(_cellValue) ? FormulaA1 : _cellValue;
137137
}
138138
}
139139

@@ -257,7 +257,7 @@ private Tuple<string, bool> SetKnownTypedValue<T>(T value, XLStyleValue style, B
257257
{
258258
parsedValue = value.ObjectToInvariantString();
259259
_dataType = XLDataType.Text;
260-
if (parsedValue.Contains(Environment.NewLine) && !style.Alignment.WrapText)
260+
if (parsedValue.Contains(XLConstants.NewLine) && !style.Alignment.WrapText)
261261
Style.Alignment.WrapText = true;
262262

263263
parsed = true;
@@ -328,7 +328,7 @@ private string DeduceCellValueByParsing(string value, XLStyleValue style)
328328
value = value.Substring(1, value.Length - 1);
329329

330330
_dataType = XLDataType.Text;
331-
if (value.Contains(Environment.NewLine) && !style.Alignment.WrapText)
331+
if (value.Contains(XLConstants.NewLine) && !style.Alignment.WrapText)
332332
Style.Alignment.WrapText = true;
333333

334334
this.Style.SetIncludeQuotePrefix();
@@ -354,7 +354,7 @@ private string DeduceCellValueByParsing(string value, XLStyleValue style)
354354
else
355355
{
356356
_dataType = XLDataType.Text;
357-
if (value.Contains(Environment.NewLine) && !style.Alignment.WrapText)
357+
if (value.Contains(XLConstants.NewLine) && !style.Alignment.WrapText)
358358
Style.Alignment.WrapText = true;
359359
}
360360

@@ -583,7 +583,7 @@ private Object ParseCellValueFromString()
583583
private Object ParseCellValueFromString(String cellValue, XLDataType dataType, out String error)
584584
{
585585
error = "";
586-
if ("" == cellValue)
586+
if (string.IsNullOrEmpty(cellValue))
587587
return "";
588588

589589
if (dataType == XLDataType.Boolean)
@@ -2317,7 +2317,7 @@ private void SetValue(object value)
23172317
parsedValue = value.ObjectToInvariantString();
23182318

23192319
_dataType = XLDataType.Text;
2320-
if (parsedValue.Contains(Environment.NewLine) && !style.Alignment.WrapText)
2320+
if (parsedValue.Contains(XLConstants.NewLine) && !style.Alignment.WrapText)
23212321
Style.Alignment.WrapText = true;
23222322

23232323
parsed = true;

ClosedXML/Excel/Columns/XLColumn.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
using SkiaSharp;
12
using System;
23
using System.Collections.Generic;
3-
using System.Drawing;
44
using System.Linq;
55

66
namespace ClosedXML.Excel
@@ -171,7 +171,7 @@ public IXLColumn AdjustToContents(Int32 startRow, Double minWidth, Double maxWid
171171

172172
public IXLColumn AdjustToContents(Int32 startRow, Int32 endRow, Double minWidth, Double maxWidth)
173173
{
174-
var fontCache = new Dictionary<IXLFontBase, Font>();
174+
var fontCache = new Dictionary<IXLFontBase, SKFont>();
175175

176176
Double colMaxWidth = minWidth;
177177

@@ -194,7 +194,7 @@ public IXLColumn AdjustToContents(Int32 startRow, Int32 endRow, Double minWidth,
194194

195195
Double thisWidthMax = 0;
196196
Int32 textRotation = cellStyle.Alignment.TextRotation;
197-
if (c.HasRichText || textRotation != 0 || c.InnerText.Contains(Environment.NewLine))
197+
if (c.HasRichText || textRotation != 0 || c.InnerText.Contains(XLConstants.NewLine))
198198
{
199199
var kpList = new List<KeyValuePair<IXLFontBase, string>>();
200200

@@ -205,27 +205,27 @@ public IXLColumn AdjustToContents(Int32 startRow, Int32 endRow, Double minWidth,
205205
foreach (IXLRichString rt in c.RichText)
206206
{
207207
String formattedString = rt.Text;
208-
var arr = formattedString.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
208+
var arr = formattedString.Split(new[] { XLConstants.NewLine }, StringSplitOptions.None);
209209
Int32 arrCount = arr.Count();
210210
for (Int32 i = 0; i < arrCount; i++)
211211
{
212212
String s = arr[i];
213213
if (i < arrCount - 1)
214-
s += Environment.NewLine;
214+
s += XLConstants.NewLine;
215215
kpList.Add(new KeyValuePair<IXLFontBase, String>(rt, s));
216216
}
217217
}
218218
}
219219
else
220220
{
221221
String formattedString = c.GetFormattedString();
222-
var arr = formattedString.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
222+
var arr = formattedString.Split(new[] { XLConstants.NewLine }, StringSplitOptions.None);
223223
Int32 arrCount = arr.Count();
224224
for (Int32 i = 0; i < arrCount; i++)
225225
{
226226
String s = arr[i];
227227
if (i < arrCount - 1)
228-
s += Environment.NewLine;
228+
s += XLConstants.NewLine;
229229
kpList.Add(new KeyValuePair<IXLFontBase, String>(cellStyle.Font, s));
230230
}
231231
}
@@ -243,7 +243,7 @@ public IXLColumn AdjustToContents(Int32 startRow, Int32 endRow, Double minWidth,
243243
var f = kp.Key;
244244
String formattedString = kp.Value;
245245

246-
Int32 newLinePosition = formattedString.IndexOf(Environment.NewLine);
246+
Int32 newLinePosition = formattedString.IndexOf(XLConstants.NewLine);
247247
if (textRotation == 0)
248248
{
249249
#region if (newLinePosition >= 0)
@@ -663,4 +663,4 @@ public override Boolean IsEntireColumn()
663663
return true;
664664
}
665665
}
666-
}
666+
}

ClosedXML/Excel/Comments/XLComment.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public IXLComment SetAuthor(String value)
3737
public IXLRichString AddSignature()
3838
{
3939
AddText(Author + ":").SetBold();
40-
return AddText(Environment.NewLine);
40+
return AddText(XLConstants.NewLine);
4141
}
4242

4343
public void Delete()
@@ -199,4 +199,4 @@ private void Initialize(XLCell cell, IXLDrawingStyle style = null, int? shapeId
199199
ShapeId = shapeId.Value;
200200
}
201201
}
202-
}
202+
}

ClosedXML/Excel/ConditionalFormats/Save/XLCFDataBarConverterExtension.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ public ConditionalFormattingRule Convert(IXLConditionalFormat cf, XLWorkbook.Sav
5050

5151
var barAxisColor = new BarAxisColor { Rgb = XLColor.Black.Color.ToHex() };
5252

53-
var negativeFillColor = new NegativeFillColor { Rgb = cf.Colors[1].Color.ToHex() };
53+
var negativeFillColor = new NegativeFillColor { Rgb = (cf.Colors[1].Color.ToHex()) };
5454
if (cf.Colors.Count == 2)
5555
{
56-
negativeFillColor = new NegativeFillColor { Rgb = cf.Colors[2].Color.ToHex() };
56+
negativeFillColor = new NegativeFillColor { Rgb = (cf.Colors[2].Color.ToHex()) };
5757
}
5858

5959
dataBar.Append(cfMin);
@@ -73,16 +73,22 @@ private ConditionalFormattingValueObjectTypeValues Convert(DocumentFormat.OpenXm
7373
{
7474
case DocumentFormat.OpenXml.Spreadsheet.ConditionalFormatValueObjectValues.Max:
7575
return ConditionalFormattingValueObjectTypeValues.AutoMax;
76+
7677
case DocumentFormat.OpenXml.Spreadsheet.ConditionalFormatValueObjectValues.Min:
7778
return ConditionalFormattingValueObjectTypeValues.AutoMin;
79+
7880
case DocumentFormat.OpenXml.Spreadsheet.ConditionalFormatValueObjectValues.Number:
7981
return ConditionalFormattingValueObjectTypeValues.Numeric;
82+
8083
case DocumentFormat.OpenXml.Spreadsheet.ConditionalFormatValueObjectValues.Percent:
8184
return ConditionalFormattingValueObjectTypeValues.Percent;
85+
8286
case DocumentFormat.OpenXml.Spreadsheet.ConditionalFormatValueObjectValues.Percentile:
8387
return ConditionalFormattingValueObjectTypeValues.Percentile;
88+
8489
case DocumentFormat.OpenXml.Spreadsheet.ConditionalFormatValueObjectValues.Formula:
8590
return ConditionalFormattingValueObjectTypeValues.Formula;
91+
8692
default:
8793
throw new NotImplementedException();
8894
}

0 commit comments

Comments
 (0)