ClosedXML 0.97.0
Prefix ReservedSee the version list below for details.
dotnet add package ClosedXML --version 0.97.0
NuGet\Install-Package ClosedXML -Version 0.97.0
<PackageReference Include="ClosedXML" Version="0.97.0" />
paket add ClosedXML --version 0.97.0
#r "nuget: ClosedXML, 0.97.0"
// Install ClosedXML as a Cake Addin #addin nuget:?package=ClosedXML&version=0.97.0 // Install ClosedXML as a Cake Tool #tool nuget:?package=ClosedXML&version=0.97.0
Release 0.97 - Laying foundation
See full list of changes at https://github.com/ClosedXML/ClosedXML/milestone/17?closed=1
Breaking changes
- Methods that were depending on the
System.Common.Drawing
were removed (use another overload): -
IXLPictures.AddPicture(Bitmap bitmap)
-
IXLPictures.AddPicture(Bitmap bitmap, String name)
-
IXLWorksheet.AddPicture(Bitmap bitmap)
-
IXLWorksheet.AddPicture(Bitmap bitmap, string name)
- Date/time formulas (NOW(), HOUR()...) returns serial date-time, cell is no longer implicitly
XLDataType.DateTime
orXLDataType.TimeSpan
. The DataType has to be set explicitely. - CalcEngine can now return XLError on error, not a CalcEngineException exception.
Improvements
System.Drawing.Common removal (#1805)
We have removed a System.Drawing.Common dependency, it was deprecated and throws runtime exception when called on non-windows environments. All complexity has been hidden behind an interface IXLGraphicEngine
and a default implementation DefaultGraphicEngine
in the `ClosedXML.Graphics namespace. The default engine uses SixLabors.Fonts library for font measurements. You can read more on the Graphic Engine wiki page.
On non-windows environment, it will be necessary to specify a default font. Use this code
// All workbooks created later will use the engine with a fallback font DejaVu Sans
LoadOptions.DefaultGraphicsEngine = new DefaultGraphicEngine("DejaVu Sans"); // or Tahoma or any other font that is installed
Use XLParser to parse formulas
ClosedXML has used a handcrafted parser for a while. The parse could parse a simple formulas, but a lot of features were out of its grasp (e.g. arrays, references to other worksheets, operations on references and so much more). We have replaced the original the original parser with the XLParser to facilitate a more powerful formulas.
You can try the parsing yourself on an online demo page: https://xlparser.perfectxl.nl/demo/
Through slower than the original parser, we are working with upstream to improve performance (https://github.com/spreadsheetlab/XLParser/issues/163, https://github.com/spreadsheetlab/XLParser/issues/161). Not-so-close future of CalcEngine is also multi threaded.
CalcEngine redesign
CalcEngine has been half-rewritten. It can now correctly represent all Excel types (e.g. Error is now a value, not an an exception) and perform operations on them (e.g. reference unions, comparisons work as they should).
As an example, SUM of two areas that overlap should count overlapping cells twice, thus the result should be 12, not 9.
using var wb = new XLWorkbook();
var ws = wb.AddWorksheet();
ws.Range(1, 1, 3, 3).SetValue(1);
var sum = ws.Evaluate("SUM((A1:B3,B1:C3))");
Console.WriteLine($"Result of a SUM function: {sum}");
Result of a SUM function: 12
A major change has been implicit intersections in the semantic of 2019 excel (Excel 2021 and 365 already support dynamic array formulas):
using var wb = new XLWorkbook();
var ws = wb.AddWorksheet();
ws.Cell("A1").SetValue(0);
ws.Cell("A2").SetValue(Math.PI / 4);
ws.Cell("A3").SetValue(Math.PI / 2);
var c1 = ws.Cell("C1");
c1.FormulaA1 = "SIN(A1:A3)";
var c2 = ws.Cell("C2");
c2.FormulaA1 = "SIN(A1:A3)";
var c3 = ws.Cell("C3");
c3.FormulaA1 = "SIN(A1:A3)";
Console.WriteLine($"C1: {c1.Value} C2: {c2.Value} C3: {c3.Value}");
C1: 0 C2: 0.7071067811865472 C3: 1
XLWorksheet.Evaluate
functions now have an optional parameters to specify a context where is formula evaluated. If formula requires a context and it is missing, it will throw a MissingContextException
.
using var wb = new XLWorkbook();
var ws = wb.AddWorksheet();
var row = ws.Evaluate("ROW()", "A3"); // Needs A3 for the context, otherwise MissingContextException
Console.WriteLine($"Result of a ROW function: {row}");
Add ROW #1851 and COLUMN # 1818 functions
We have added a support for ROW and COLUMN functions. They even return arrays (e.g. formula ROW(A2:D4)
return {2;3;4}
) , though it is difficult to see due to half revamped of CalcEngine.
using var wb = new XLWorkbook();
var ws = wb.AddWorksheet();
var sum = ws.Evaluate("SUM(COLUMN(B1:D2))");
Console.WriteLine($"Result: {sum}");
Result: 9
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- DocumentFormat.OpenXml (>= 2.16.0)
- ExcelNumberFormat (>= 1.1.0)
- Microsoft.CSharp (>= 4.7.0)
- SixLabors.Fonts (>= 1.0.0-beta18)
- System.Buffers (>= 4.5.1)
- System.IO.Packaging (>= 4.7.0)
- System.Memory (>= 4.5.4)
- XLParser (>= 1.5.2)
NuGet packages (384)
Showing the top 5 NuGet packages that depend on ClosedXML:
Package | Downloads |
---|---|
ClosedXML.Report
ClosedXML.Report is a tool for report generation and data analysis in .NET applications through the use of Microsoft Excel. ClosedXML.Report is a .NET-library for report generation Microsoft Excel without requiring Excel to be installed on the machine that's running the code. |
|
CsvHelper.Excel.Core
An implementation of ICsvParser and ICsvSerializer from CsvHelper that reads and writes using the ClosedXml library. |
|
ClosedXML.Extensions.Mvc
MVC extensions for ClosedXML |
|
ClosedXML.Extensions.WebApi
WebApi extensions for ClosedXML |
|
SanteDB.BI
SanteDB Business Intelligence (BI) core logic. Provides structures for data sources, queries, reports, and report controls rendered in all SanteDB software solutions. |
GitHub repositories (33)
Showing the top 5 popular GitHub repositories that depend on ClosedXML:
Repository | Stars |
---|---|
nopSolutions/nopCommerce
ASP.NET Core eCommerce software. nopCommerce is a free and open-source shopping cart.
|
|
mini-software/MiniExcel
Fast, Low-Memory, Easy Excel .NET helper to import/export/template spreadsheet (support Linux, Mac)
|
|
YarnSpinnerTool/YarnSpinner
Yarn Spinner is a tool for building interactive dialogue in games!
|
|
open-rpa/openrpa
Free Open Source Enterprise Grade RPA
|
|
phongnguyend/Practical.CleanArchitecture
Full-stack .Net 8 Clean Architecture (Microservices, Modular Monolith, Monolith), Blazor, Angular 18, React 18, Vue 3, BFF with YARP, Domain-Driven Design, CQRS, SOLID, Asp.Net Core Identity Custom Storage, OpenID Connect, Entity Framework Core, OpenTelemetry, SignalR, Hosted Services, Health Checks, Rate Limiting, Cloud Services (Azure, AWS, GCP).
|
Version | Downloads | Last updated |
---|---|---|
0.104.1 | 507,409 | 9/30/2024 |
0.104.0-rc1 | 24,796 | 9/17/2024 |
0.104.0-preview2 | 297,362 | 10/26/2023 |
0.103.0-beta | 25,901 | 9/28/2023 |
0.102.3 | 1,541,824 | 7/18/2024 |
0.102.2 | 6,431,879 | 1/5/2024 |
0.102.1 | 4,432,223 | 8/18/2023 |
0.102.0 | 1,763,597 | 6/24/2023 |
0.102.0-rc | 6,192 | 6/18/2023 |
0.101.0 | 2,866,038 | 4/9/2023 |
0.101.0-rc | 4,667 | 4/1/2023 |
0.100.3 | 3,636,806 | 1/12/2023 |
0.100.2 | 59,950 | 1/10/2023 |
0.100.1 | 26,331 | 1/9/2023 |
0.100.0 | 125,038 | 1/9/2023 |
0.97.0 | 4,252,703 | 10/21/2022 |
0.96.0 | 6,194,099 | 6/29/2022 |
0.95.4 | 21,870,143 | 12/16/2020 |
0.95.3 | 8,610,661 | 5/25/2020 |
0.95.2 | 715,141 | 4/26/2020 |
0.95.1 | 216,777 | 4/23/2020 |
0.95.0 | 1,148,892 | 4/15/2020 |
0.95.0-beta2 | 101,254 | 8/21/2019 |
0.95.0-beta1 | 44,270 | 4/4/2019 |
0.94.2 | 6,652,676 | 12/18/2018 |
0.94.0 | 69,731 | 12/12/2018 |
0.94.0-rc2 | 5,315 | 11/29/2018 |
0.94.0-rc1 | 8,539 | 11/11/2018 |
0.93.1 | 1,084,243 | 8/7/2018 |
0.93.0 | 502,076 | 6/25/2018 |
0.93.0-rc3 | 8,156 | 6/7/2018 |
0.93.0-rc2 | 4,230 | 5/31/2018 |
0.93.0-beta4 | 4,732 | 5/14/2018 |
0.93.0-beta2 | 5,400 | 4/26/2018 |
0.93.0-beta1 | 2,922 | 4/19/2018 |
0.92.1 | 1,144,242 | 4/10/2018 |
0.92.0-beta1 | 5,902 | 3/22/2018 |
0.91.1 | 61,165 | 4/4/2018 |
0.91.0 | 305,915 | 1/31/2018 |
0.91.0-beta3 | 4,233 | 1/23/2018 |
0.91.0-beta2 | 14,545 | 12/8/2017 |
0.91.0-beta1 | 2,957 | 11/29/2017 |
0.90.0 | 750,753 | 10/23/2017 |
0.90.0-beta2 | 3,257 | 10/6/2017 |
0.89.0 | 397,930 | 9/12/2017 |
0.89.0-beta1 | 5,300 | 8/23/2017 |
0.88.0 | 224,306 | 7/24/2017 |
0.88.0-beta1 | 10,551 | 7/10/2017 |
0.87.1 | 1,739,826 | 4/3/2017 |
0.86.0 | 431,113 | 1/6/2017 |
0.85.0 | 343,827 | 12/7/2016 |
0.80.1 | 736,753 | 9/15/2016 |
0.76.0 | 1,679,489 | 12/16/2014 |
0.75.0 | 212,285 | 9/17/2014 |
0.74.0 | 42,413 | 8/10/2014 |
0.73.0 | 39,891 | 6/24/2014 |
0.72.3 | 28,591 | 6/4/2014 |
0.72.2 | 4,642 | 6/4/2014 |
0.72.1 | 58,241 | 6/4/2014 |
0.72.0 | 11,266 | 6/4/2014 |
0.71.1 | 17,490 | 5/26/2014 |
0.70.0 | 13,101 | 5/18/2014 |
0.69.2 | 165,871 | 10/3/2013 |
0.69.1 | 86,242 | 8/15/2013 |
0.69.0 | 7,551 | 8/10/2013 |
0.68.1 | 105,107 | 10/20/2012 |
0.68.0 | 6,087 | 10/12/2012 |
0.67.2 | 23,852 | 8/14/2012 |
0.67.1 | 4,682 | 8/13/2012 |
0.67.0 | 4,802 | 8/12/2012 |
0.66.1 | 5,478 | 7/28/2012 |
0.66.0 | 5,055 | 7/18/2012 |
0.65.2 | 10,285 | 4/21/2012 |
0.64.0 | 23,223 | 2/4/2012 |