Skip to content

Releases: sveinungf/spreadcheetah

v1.11.0

02 Sep 14:09
Compare
Choose a tag to compare

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 a Format property that is intended to replace the NumberFormat 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. The Format 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 on Style has been marked as obsolete. Existing code should migrate to use the Format property instead, either by using Format = NumberFormat.Standard(...) to use one of the standard formats from Excel, or Format = NumberFormat.Custom(...) to use a custom format.

Other changes

v1.10.0

24 Jun 12:57
Compare
Choose a tag to compare

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 to false.
  • Added utility method SpreadsheetUtility.TryGetColumnNameUtf8. Similarly to SpreadsheetUtility.GetColumnName it converts a column number (e.g. 1) into a column name (e.g. A). SpreadsheetUtility.TryGetColumnNameUtf8 will write the result into a Span<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

19 Feb 11:25
Compare
Choose a tag to compare

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 to Spreadsheet.AddDataValidation. TryAddDataValidation will return false if attempting to add too many data validations to a worksheet, while AddDataValidation 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 name A.

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

14 Jan 09:39
Compare
Choose a tag to compare

Features

  • Added support for text alignments. Alignments are specificed using the Alignment property on a Style 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 takes ReadOnlyMemory<T> of cells and RowOptions.
  • 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 the Spreadsheet is properly disposed.

Breaking changes

  • The Style class and related style classes have changed to become records.

v1.7.0

06 Nov 21:48
Compare
Choose a tag to compare

Features

  • Added support for cell borders. Borders are specified using the Border property on a Style 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 to DataValidation.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 added DataValidation.TryCreateListValues() can be used as an alternative when exception handling is not desired.

v1.6.0

17 Sep 21:39
Compare
Choose a tag to compare

Features

  • Added support for specifying the number format for cells. This is done by setting the NumberFormat property on a Style object. Some predefined formats can be found in the NumberFormats class.
  • Added support for DateTime cells. Use a style with a number format to determine how the DateTime values should be displayed. If no number format has been set, the number format will default to DefaultDateTimeNumberFormat on SpreadCheetahOptions.
  • Added the method AddRangeAsRowsAsync() that supplements AddAsRowAsync(). AddRangeAsRowsAsync() takes an IEnumerable<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 a Style object after calling AddStyle() will no longer be applied to the returned style ID.

v1.5.0

23 Apr 11:53
Compare
Choose a tag to compare

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 to AddRowAsync.
  • 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 deprecated SpreadCheetah.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 the SpreadCheetah 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

13 Jun 12:19
Compare
Choose a tag to compare

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 and StyledCell have changed and are no longer public.

v1.3.0

21 Feb 22:57
Compare
Choose a tag to compare

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 implements IAsyncDisposable.

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

25 Nov 18:15
Compare
Choose a tag to compare

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 and long?.

Breaking changes

  • Removed the deprecated Cell struct. It has been replaced by DataCell.