0.102.0-rc: Stepping stones
Pre-releaseSignificant changes
Replaced cell storage engine (#1969)
The cells in a workbook used to be stored in a Dictionary<int, Dictionary<XLCell>>
. That has several significant drawbacks and the storage has been replaced with a sparse arrays of individual slices (basically a sparse array containing a specific part of a cell).
Key benefits (in long term):
- Decrease in memory consumption - sparse arrays don't use values that aren't use, from esoteric OLAP cube id to styles.
- Bulk operations - there was pretty much no way to optimize bulk operations. Clear - go through each cell. With sparse arrays, ClosedXML can operate on pices of an array (e.g. preallocate for large inserts, clear an area).
- Most operations use only data from a slice (e.g. setting a formula doesn't have to check all cells, only those that contain formula). Due to nature of sparse array of a slice, I only need to go through cells that contains actually useful content.
- Easier insertion/deletion of rows. XLCell originally contain an address and when a row was inserted, I had to go though all cells and fix address (+ 20 other things).
Other than memory, it's a potential for the future. Replacing a storage engine is not simple and pretty much everything uses XLCell
adapter.
An example of different for 500k rows of value only cells (gist). About 200MB vs 900MB.
Embedded fonts (#2106)
Default graphic engine of ClosedXML now contains an embedded font. That should be a quality of life improvement for users on Linux and other non-Windows environment who encountered
Unable to find font font name or fallback font fallback font name. Install missing fonts or specify a different fallback font through ‘LoadOptions.DefaultGraphicEngine = new DefaultGraphicEngine(“Fallback font name”)’..
The embedded font is an absolute bare bones Carlito font (though with a different name to avoid collision with the real one).
See doc for workflow of font selection: https://closedxml.readthedocs.io/en/latest/features/graphic-engine.html#fallback-and-embedded-font
Array formulas
A basic support for array formulas has been added. You can create array formula through IXLRangeBase
object.
csharp ws.Range("B2:D3").FormulaArrayA1 = "B1:D1*POWER(1+A2:A3, 2)";
For more info, see doc: https://closedxml.readthedocs.io/en/latest/features/formulas.html#array-formulas
Refactored pivot source (#1238)
The ancient PR from 2019 has been finally fixed and merged. It doesn't really add very useful features (multiple pivot tables don't have to have individual data store files in a xlsx file), but it is a big step to represent pivot cache data in a workbook. That is pretty much required to do anything useful with pivot tables.
The biggest visible improvement is that there is at least some very basic documentation about pivot tables https://closedxml.readthedocs.io/en/latest/features/pivot-tables.html
Misc info & next release
Not really something that is useful at this moment, but there has been significant work done on a replacement of a XLParser (https://github.com/ClosedXML/ClosedXML.Parser).
I hope to be done with the Phase 1 of my maintainership - architecture and dependencies. Most of the "OMG, this must be done before anything else" has been done. I hope to finish the rest (split writers of individual files from 5000+LOC file, use better parser and use calculation chain for formula evaluation) in the next one.
What's Changed
Performance improvements
- Having many hyperlinks caused slow save by @jahav in #2076
- Fix Stack Overflow exception and optimize for bigger datasets by @JakubTracz in #2042
- Use spare arrays to store cell values. by @jahav in #2093
Features
- Add ability to read WebP images by @jahav in #2071
- Implement array formulas by @jahav in #2082
- Include an embedded font to ClosedXML by @jahav in #2106
- Consolidated and refactored pivot sources by @igitur in #1238
- Add ability to set table name when adding a worksheet with datatable … by @NickNack2020 in
Bugfixes
- SUMIFS multiple dimensions by @igitur in #2061
- Handle different number types of NumberLiteral by @jahav in #2058
- Don't fail to load empty style part by @jahav in #2102
Documentation
- Update IXLCell.cs Wrong summary on GetDouble() by @MortenSpjotvoll in #2059
- Enable nullables in main project by @lahma in #2056
Quality of life
New Contributors
- @MortenSpjotvoll made their first contribution in #2059
- @JakubTracz made their first contribution in #2042
Full Changelog: 0.101.0...0.102-rc