Releases: sveinungf/spreadcheetah
Releases · sveinungf/spreadcheetah
v1.11.0
Features
- Support for adding a note to a cell with
Spreadsheet.AddNote(string cellReference, string noteText)
. Currently plain-text notes without styling are supported. - Added utility method
SpreadsheetUtility.TryParseColumnName
. It will try to parse a column name (e.g.A
) to its column number (e.g. 1). - The
Style
class now has aFormat
property that is intended to replace theNumberFormat
property. Previously there was an issue that a format could automatically use one of the locale dependent standard formats from Excel, even if the user wanted to specify a custom format. TheFormat
property allows for explicitly specifying whether the number format should be a custom or a standard one. Thanks to @AlexVallat for the contribution!
Breaking changes
- The
NumberFormat
property onStyle
has been marked as obsolete. Existing code should migrate to use theFormat
property instead, either by usingFormat = NumberFormat.Standard(...)
to use one of the standard formats from Excel, orFormat = NumberFormat.Custom(...)
to use a custom format.
Other changes
- The assembly is now signed with a strong name.
- The .NET Standard targets of the library are no longer marked as being trimmable. This is because those targets don't support trimming (https://learn.microsoft.com/en-us/dotnet/core/compatibility/sdk/8.0/trimming-unsupported-targetframework). .NET 6 and later targets are still marked as being trimmable.
v1.10.0
Features
- Reduced memory allocations for writing the resulting XLSX file. This should improve performance for spreadsheets containing styles, data validations, cell merges, or multiple worksheets.
- Added option
SpreadCheetahOptions.WriteCellReferenceAttributes
which enables writing the explicit cell reference on each cell. This is not required when the spreadsheet is being opened in Excel, but it is required for doing a comparison with Microsoft's Spreadsheet Compare tool. The option defaults tofalse
. - Added utility method
SpreadsheetUtility.TryGetColumnNameUtf8
. Similarly toSpreadsheetUtility.GetColumnName
it converts a column number (e.g. 1) into a column name (e.g.A
).SpreadsheetUtility.TryGetColumnNameUtf8
will write the result into aSpan<byte>
. - Other minor performance improvements.
Bug fixes
- Font names can no longer exceed 31 characters, due to it being the limit in Excel. Attempting to use a longer font name will now cause an exception to be thrown.
- Cell references can no longer refer to row number 0. E.g.
A0
is no longer allowed and will cause an exception to be thrown. - Fixed an issue that could occur when writing multiple cells with values longer than the buffer size.
v1.9.0
Features
- Added support for merging cells. To merge a range of cells together, call
Spreadsheet.MergeCells
with the range as the parameter. - Added initial support for auto filtering. For now it can be enabled by setting
WorksheetOptions.AutoFilter
. Thanks to @mderubertis-velan for the contribution! - Added
Spreadsheet.TryAddDataValidation
as an alternative toSpreadsheet.AddDataValidation
.TryAddDataValidation
will returnfalse
if attempting to add too many data validations to a worksheet, whileAddDataValidation
will throw an exception. - Added utility method
SpreadsheetUtility.GetColumnName
. It returns the column name from a column number, e.g. column number 1 will return column nameA
.
Breaking changes
Spreadsheet.AddDataValidation
will now throw an exception if attempting to add more than 65534 data validations to a worksheet (Excel limitation).
v1.8.0
Features
- Added support for text alignments. Alignments are specificed using the
Alignment
property on aStyle
object. - Added support for hiding worksheets by setting
WorksheetOptions.Visibility
. - Added support for absolute references in data validations. Can now use for example
$A$1:$A$5
as a cell range. - Added an option to get the next row number from the active worksheet with
Spreadsheet.NextRowNumber
. - Added overloads for
AddRowAsync
which takesReadOnlyMemory<T>
of cells andRowOptions
. - Updated
Spreadsheet.FinishAsync
to also flush the resulting archive. This should prevent a partially corrupt XLSX file if the XLSX file is being used before theSpreadsheet
is properly disposed.
Breaking changes
- The
Style
class and related style classes have changed to become records.
v1.7.0
Features
- Added support for cell borders. Borders are specified using the
Border
property on aStyle
object. - Added support for Data Validation with list values from a cell range. These can be created with
DataValidation.ListValuesFromCells()
. - Added
DataValidation.TryCreateListValues()
as a non-throwing alternative toDataValidation.ListValues()
. - Minor performance improvements of writing cells to the resulting spreadsheet file.
Bug fixes
- Fixed an issue where
Spreadsheet.AddDataValidation()
would allow a cell reference that contained digit characters other than 0-9.
Breaking changes
DataValidation.ListValues()
will now throw an exception if the combined length of the values exceed the maximum allowed in Excel (255 characters). The newly addedDataValidation.TryCreateListValues()
can be used as an alternative when exception handling is not desired.
v1.6.0
Features
- Added support for specifying the number format for cells. This is done by setting the
NumberFormat
property on aStyle
object. Some predefined formats can be found in theNumberFormats
class. - Added support for
DateTime
cells. Use a style with a number format to determine how theDateTime
values should be displayed. If no number format has been set, the number format will default toDefaultDateTimeNumberFormat
onSpreadCheetahOptions
. - Added the method
AddRangeAsRowsAsync()
that supplementsAddAsRowAsync()
.AddRangeAsRowsAsync()
takes anIEnumerable<T>
of objects and adds them as rows in a worksheet. - Identical styles will now reference the same style internally. This will prevent an increase to the file size if the same or an identical style were to be added multiple times with
AddStyle()
. - Minor improvements to reduce memory allocations.
Bug fixes
- Fixed a serialization issue that could occur for cells with a very long formula text and a cached number value.
Breaking changes
AddStyle()
will now make a copy of the style when it is being called. Changes to aStyle
object after callingAddStyle()
will no longer be applied to the returned style ID.
v1.5.0
Features
- Added support for Data Validations. Currently supported for integers, decimals, text lengths, and list values.
- Added support for specifying row heights.
- Added support for specifying the font name for styles.
- Added support for freezing columns and rows.
- Added
ReadOnlyMemory<T>
overloads toAddRowAsync
. - The package is now annotated as being trimmable.
- Minor performance improvements.
- Added a new source generator for creating a worksheet row from an object. The new source generator is included in the
SpreadCheetah
package and replaces the previous one from the now deprecatedSpreadCheetah.SourceGenerator
package. The new source generator has the following improvements over the old one:- Less memory allocated by the generated code.
- Usage is now similar to the
System.Text.Json
source generator. Familiarity with one should make it easier to use the other. - Added an option to suppress potential warnings from the source generator.
- The new generator is an incremental source generator, which should have a smaller impact on the build than the previous first generation generator.
Bug fixes
- Fixed a possible incompatibility issue if the .NET Standard 2.0 variant of the library was used in a .NET Standard 2.1 compatible framework.
Breaking changes
- The
SpreadCheetah.SourceGenerator
package is now deprecated. It has been replaced by the source generator included in theSpreadCheetah
package. - Two worksheets in the same file can no longer have an identical name but with different casing. There is a potential issue with opening such a file in Excel. Attempting to create such a file now will throw an exception.
v1.4.0
SpreadCheetah
Features
- Added support for formulas with the new
Cell
type.Cell
also supports plain cell values and styling. - Added support for specifying font size.
- Increased performance and reduced allocations, especially for cells containing numeric values.
Bug fixes
- Fixed an issue with a missing attribute value in
styles.xml
.
Breaking changes
- Public properties on
DataCell
andStyledCell
have changed and are no longer public.
v1.3.0
SpreadCheetah
Features
- Added support for font color styling.
- Added support for fill color styling.
- Added documentation on all public classes and methods.
- Enabled support for Source Link.
Spreadsheet
now implementsIAsyncDisposable
.
Breaking changes
- Attempting to start a new worksheet after
FinishAsync
have been called will now result in an exception being thrown.
SpreadCheetah.SourceGenerator
Features
AddAsRowAsync
will now only generate cells for supported types.AddAsRowAsync
will now emit a warning for unsupported cell types.- Minor performance improvement of generated code.
v1.2.0
Features
- Initial support for creating a row from an object using a Source Generator.
- Added support for more font styling: italic and strikethrough.
- Added support for creating cells directly from
long
andlong?
.
Breaking changes
- Removed the deprecated
Cell
struct. It has been replaced byDataCell
.