ClosedXML 0.97.0

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package ClosedXML --version 0.97.0
NuGet\Install-Package ClosedXML -Version 0.97.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ClosedXML" Version="0.97.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ClosedXML --version 0.97.0
#r "nuget: ClosedXML, 0.97.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// 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 or XLDataType.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

image

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (336)

Showing the top 5 NuGet packages that depend on ClosedXML:

Package Downloads
ClosedXML.Report The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

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 The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

MVC extensions for ClosedXML

CyberEye.Constant.Lib

Package chứa các constant và enum

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 (29)

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.
fullstackhero/dotnet-webapi-starter-kit
production grade .net 8 webapi starter kit with multitenancy support and clean code. 🔥
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
Version Downloads Last updated
0.104.0-preview2 101,338 10/26/2023
0.103.0-beta 13,698 9/28/2023
0.102.2 1,298,747 1/5/2024
0.102.1 2,765,832 8/18/2023
0.102.0 1,267,011 6/24/2023
0.102.0-rc 3,966 6/18/2023
0.101.0 2,014,646 4/9/2023
0.101.0-rc 3,667 4/1/2023
0.100.3 2,848,164 1/12/2023
0.100.2 51,976 1/10/2023
0.100.1 20,845 1/9/2023
0.100.0 103,888 1/9/2023
0.97.0 3,327,007 10/21/2022
0.96.0 4,671,820 6/29/2022
0.95.4 18,962,275 12/16/2020
0.95.3 8,061,066 5/25/2020
0.95.2 665,712 4/26/2020
0.95.1 204,087 4/23/2020
0.95.0 997,562 4/15/2020
0.95.0-beta2 90,834 8/21/2019
0.95.0-beta1 42,779 4/4/2019
0.94.2 5,802,157 12/18/2018
0.94.0 64,268 12/12/2018
0.94.0-rc2 5,221 11/29/2018
0.94.0-rc1 8,360 11/11/2018
0.93.1 1,014,815 8/7/2018
0.93.0 473,175 6/25/2018
0.93.0-rc3 8,067 6/7/2018
0.93.0-rc2 4,017 5/31/2018
0.93.0-beta4 4,662 5/14/2018
0.93.0-beta2 5,302 4/26/2018
0.93.0-beta1 2,838 4/19/2018
0.92.1 946,513 4/10/2018
0.92.0-beta1 5,486 3/22/2018
0.91.1 55,134 4/4/2018
0.91.0 285,053 1/31/2018
0.91.0-beta3 4,137 1/23/2018
0.91.0-beta2 14,221 12/8/2017
0.91.0-beta1 2,876 11/29/2017
0.90.0 691,334 10/23/2017
0.90.0-beta2 3,196 10/6/2017
0.89.0 371,971 9/12/2017
0.89.0-beta1 5,109 8/23/2017
0.88.0 211,098 7/24/2017
0.88.0-beta1 10,487 7/10/2017
0.87.1 1,454,067 4/3/2017
0.86.0 398,490 1/6/2017
0.85.0 315,482 12/7/2016
0.80.1 674,603 9/15/2016
0.76.0 1,581,984 12/16/2014
0.75.0 199,096 9/17/2014
0.74.0 36,290 8/10/2014
0.73.0 38,483 6/24/2014
0.72.3 25,516 6/4/2014
0.72.2 3,872 6/4/2014
0.72.1 56,065 6/4/2014
0.72.0 8,741 6/4/2014
0.71.1 15,047 5/26/2014
0.70.0 11,123 5/18/2014
0.69.2 159,571 10/3/2013
0.69.1 76,317 8/15/2013
0.69.0 6,584 8/10/2013
0.68.1 95,577 10/20/2012
0.68.0 5,186 10/12/2012
0.67.2 21,751 8/14/2012
0.67.1 3,894 8/13/2012
0.67.0 3,998 8/12/2012
0.66.1 4,682 7/28/2012
0.66.0 4,231 7/18/2012
0.65.2 9,253 4/21/2012
0.64.0 18,104 2/4/2012