Net4x.SpreadsheetLibrary.Utility 1.9.9.6

dotnet add package Net4x.SpreadsheetLibrary.Utility --version 1.9.9.6
                    
NuGet\Install-Package Net4x.SpreadsheetLibrary.Utility -Version 1.9.9.6
                    
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="Net4x.SpreadsheetLibrary.Utility" Version="1.9.9.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Net4x.SpreadsheetLibrary.Utility" Version="1.9.9.6" />
                    
Directory.Packages.props
<PackageReference Include="Net4x.SpreadsheetLibrary.Utility" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Net4x.SpreadsheetLibrary.Utility --version 1.9.9.6
                    
#r "nuget: Net4x.SpreadsheetLibrary.Utility, 1.9.9.6"
                    
#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.
#:package Net4x.SpreadsheetLibrary.Utility@1.9.9.6
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Net4x.SpreadsheetLibrary.Utility&version=1.9.9.6
                    
Install as a Cake Addin
#tool nuget:?package=Net4x.SpreadsheetLibrary.Utility&version=1.9.9.6
                    
Install as a Cake Tool

SpreadsheetLibrary.Utility

Small utility helpers used by the SpreadsheetLibrary projects to support saving workbooks, converting legacy XLS to XLSX, and simple file-picking abstractions for UI/tooling integrations.

Purpose

  • Provide lightweight helpers that are orthogonal to core spreadsheet processing: converting .xls streams to .xlsx, selecting a save target via an abstraction, converting collections of CSV text into DataSet instances and other small helpers.
  • Keep UI/OS-specific file-picking code isolated behind ISaveFilePicker so library code remains testable and cross-platform where possible.

Main components

  • ISaveFilePicker (interface)

    • Abstraction for picking a file name/path to save to. Implement this in your UI layer or test harness to control where save dialogs appear.
    • Method: Task<(bool, string)> PickFile(string fileName) � returns a tuple indicating whether a file was selected and the selected path.
  • SaveFilePickerExtension (extensions)

    • Helpers for coordinating multiple DataTable/DataSet saves using an ISaveFilePicker implementation.
    • SaveDataTablesToExcelAsync helpers will prompt (via ISaveFilePicker) and then write Excel files when appropriate, logging issues via ILogger.
  • XlsToXlsxConverter

    • Converts an in-memory stream containing a legacy HSSF .xls workbook into an XSSF .xlsx byte array using NPOI.
    • Preserves sheet names, cell values, styles, merged regions and column widths where possible.
    • Useful for workflows that need to normalize legacy Excel files to XLSX prior to further processing.
  • SaveToDictionaryExtension and ListExtension (CSV helpers)

    • Convert string/CSV collections into dictionary-backed DataSet instances for later export to Excel or processing.
    • Provide small helpers to normalize collections and read CSV via SpreadsheetLibrary.Csv utilities.

Compatibility and dependencies

  • The utilities use NPOI (NPOI.HSSF, NPOI.XSSF, NPOI.SS) to manipulate Excel workbooks and ICSharpCode.SharpZipLib where appropriate (transitive dependency via NPOI for some runtimes).
  • The project includes code compiled for older frameworks (net35/net40) and newer netstandard targets; ensure you reference compatible NPOI packages for your target framework.

Usage examples

Convert a legacy .xls stream to .xlsx bytes:

using (var fs = File.OpenRead("legacy.xls"))
{
    var xlsxBytes = fs.ConvertXlsToXlsx();
    File.WriteAllBytes("converted.xlsx", xlsxBytes);
}

Pick a save file and write a dataset to Excel (UI specific ISaveFilePicker required):

var (ok, path) = await saveFilePicker.PickFile("20250101-120000.xls");
if (ok && !string.IsNullOrWhiteSpace(path))
{
    dataSet.ToExcel(path, isXlsx: false, logger: logger);
}

Convert an enumerable of CSV text into a DataSet for export:

var dict = SaveToDictionaryExtension.SaveToDictionary(myEnumerable);
var dataSet = dict.GetAsDataSet("Export");

Notes and recommendations

  • XlsToXlsxConverter attempts to copy styles and merged regions but very complex legacy workbooks may not round-trip perfectly.
  • ISaveFilePicker is intentionally minimal � provide an implementation appropriate for desktop, web or automated test environments.
  • The save helpers prefer a non-empty selection; callers should validate returned paths.

License / Contributing

See repository root for license and contribution guidelines.

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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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 is compatible. 
.NET Framework net35 is compatible.  net40 is compatible.  net403 was computed.  net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 is compatible.  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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.9.9.6 78 1/6/2026
1.9.9.5 75 1/6/2026
1.9.9.4 75 1/6/2026
1.9.9.3 80 1/5/2026
1.9.9.2 82 12/30/2025
1.9.9.1 86 12/30/2025
1.9.9 179 12/22/2025
1.6.0.12 121 12/12/2025
1.6.0.11 122 12/12/2025
1.6.0.10 441 12/9/2025
1.6.0.9 190 12/4/2025
1.6.0.8 189 12/4/2025
1.6.0.7 258 11/30/2025
1.6.0.6 184 11/27/2025
1.6.0.5 236 11/22/2025
1.6.0.4 144 11/16/2025
1.6.0.3 189 11/15/2025
1.6.0.2 278 11/14/2025
1.6.0.1 230 11/10/2025
1.6.0 213 11/9/2025
1.5.0.3 200 11/5/2025
1.5.0.2 201 11/3/2025
1.5.0.1 201 11/3/2025
1.5.0 158 10/26/2025
1.4.1.6 181 10/24/2025
1.4.1.5 190 10/22/2025
1.4.1.4 194 10/22/2025
1.4.1.2 206 5/30/2025
1.4.1.1 206 4/30/2025
1.4.1 203 4/30/2025
1.4.0 227 3/31/2025
1.1.0 259 8/27/2023