VOOZH about

URL: https://www.nuget.org/packages/Linger.Excel.Npoi/

⇱ NuGet Gallery | Linger.Excel.Npoi 1.4.2




Linger.Excel.Npoi 1.4.2

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Linger.Excel.Npoi --version 1.4.2
 
 
NuGet\Install-Package Linger.Excel.Npoi -Version 1.4.2
 
 
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="Linger.Excel.Npoi" Version="1.4.2" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Linger.Excel.Npoi" Version="1.4.2" />
 
Directory.Packages.props
<PackageReference Include="Linger.Excel.Npoi" />
 
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 Linger.Excel.Npoi --version 1.4.2
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Linger.Excel.Npoi, 1.4.2"
 
 
#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 Linger.Excel.Npoi@1.4.2
 
 
#: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=Linger.Excel.Npoi&version=1.4.2
 
Install as a Cake Addin
#tool nuget:?package=Linger.Excel.Npoi&version=1.4.2
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Linger.Excel.Npoi

Overview

Linger.Excel.Npoi is an implementation of the Excel manipulation interfaces defined in Linger.Excel.Contracts, based on the powerful NPOI library. This package provides high-performance Excel file operations without requiring Microsoft Office to be installed.

Features

  • Read and write Excel files (.xlsx and .xls formats) with a simple, intuitive API
  • Convert Excel data to strongly-typed object collections and vice versa
  • Data table import and export capabilities
  • Template-based Excel generation
  • Advanced styling and formatting options
  • Cell formula support and evaluation
  • Multi-worksheet management
  • Comprehensive error handling
  • Support for legacy Excel formats (.xls)

Installation

dotnet add package Linger.Excel.Npoi

Usage

Basic Setup

// Register in DI container
services.AddExcelNpoi(options => 
{
 options.DefaultDateFormat = "yyyy-MM-dd";
 options.EnableFormulaEvaluation = true;
});

// Or create an instance directly
var excel = new NpoiExcel(new ExcelOptions 
{
 DefaultDateFormat = "yyyy-MM-dd",
 EnableFormulaEvaluation = true
});

Reading Excel Files

// Convert Excel to List<T>
var users = excel.ExcelToList<UserModel>("users.xlsx");

// Convert Excel to DataTable
var dataTable = excel.ExcelToDataTable("data.xlsx", sheetName: "Sheet1");

// Read from stream
using var stream = File.OpenRead("data.xlsx");
var results = excel.ExcelToList<ResultModel>(stream);

Writing Excel Files

// Convert List<T> to Excel file
var users = GetUsers(); // Your data source
excel.ListToExcel(users, "users.xlsx");

// Convert DataTable to Excel file
var dataTable = GetDataTable(); // Your data source
excel.DataTableToExcel(dataTable, "data.xlsx");

// Export to stream (for web downloads, etc.)
using var memoryStream = new MemoryStream();
excel.ListToExcel(products, memoryStream);
return File(memoryStream.ToArray(), 
 "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", 
 "products.xlsx");

Advanced Features

// Multi-sheet operations
var workbook = excel.CreateWorkbook();
excel.AddSheet(workbook, "Users", users);
excel.AddSheet(workbook, "Products", products);
excel.SaveWorkbook(workbook, "company_data.xlsx");

// Styling
excel.ListToExcel(salesData, "sales_report.xlsx", styleOptions => 
{
 styleOptions.HeaderBackgroundColor = "#1E90FF";
 styleOptions.HeaderFontColor = "#FFFFFF";
 styleOptions.AlternatingRowBackgroundColor = "#F0F8FF";
});

// Formula evaluation
var options = new ExcelOptions
{
 EnableFormulaEvaluation = true
};
var excelWithFormulas = new NpoiExcel(options);
var calculatedData = excelWithFormulas.ExcelToList<CalculationModel>("formulas.xlsx");

NPOI-specific Features

Support for Legacy Excel Formats

// Reading .xls files
var legacyData = excel.ExcelToList<LegacyData>("old_data.xls");

// Writing .xls files
excel.ListToExcel(legacyData, "legacy_export.xls");

Cell Comments

// Access to NPOI-specific features
IWorkbook workbook = (IWorkbook)excel.CreateWorkbook();
ISheet sheet = workbook.CreateSheet("Comments");
IRow row = sheet.CreateRow(0);
ICell cell = row.CreateCell(0);
cell.SetCellValue("Cell with comment");

// Add a comment
IDrawing drawing = sheet.CreateDrawingPatriarch();
IComment comment = drawing.CreateCellComment(new XSSFClientAnchor(0, 0, 0, 0, 0, 0, 5, 5));
comment.String = new XSSFRichTextString("This is a comment");
comment.Author = "System";
cell.CellComment = comment;

excel.SaveWorkbook(workbook, "with_comments.xlsx");

Dependencies

  • NPOI (v2.7.3+)
  • Linger.Excel.Contracts

Related Packages

  • - Core interfaces and abstractions
  • - Alternative implementation using ClosedXML library

Target Frameworks

  • .NET Standard 2.0+
  • .NET 8.0+
  • .NET 9.0+
Product Versions Compatible and additional computed target framework versions.
.NET net5.0 net5.0 was computed.  net5.0-windows net5.0-windows was computed.  net6.0 net6.0 was computed.  net6.0-android net6.0-android was computed.  net6.0-ios net6.0-ios was computed.  net6.0-maccatalyst net6.0-maccatalyst was computed.  net6.0-macos net6.0-macos was computed.  net6.0-tvos net6.0-tvos was computed.  net6.0-windows net6.0-windows was computed.  net7.0 net7.0 was computed.  net7.0-android net7.0-android was computed.  net7.0-ios net7.0-ios was computed.  net7.0-maccatalyst net7.0-maccatalyst was computed.  net7.0-macos net7.0-macos was computed.  net7.0-tvos net7.0-tvos was computed.  net7.0-windows net7.0-windows was computed.  net8.0 net8.0 is compatible.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 is compatible.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 is compatible.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
.NET Core netcoreapp2.0 netcoreapp2.0 was computed.  netcoreapp2.1 netcoreapp2.1 was computed.  netcoreapp2.2 netcoreapp2.2 was computed.  netcoreapp3.0 netcoreapp3.0 was computed.  netcoreapp3.1 netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 netstandard2.0 is compatible.  netstandard2.1 netstandard2.1 was computed. 
.NET Framework net461 net461 was computed.  net462 net462 was computed.  net463 net463 was computed.  net47 net47 was computed.  net471 net471 was computed.  net472 net472 is compatible.  net48 net48 was computed.  net481 net481 was computed. 
MonoAndroid monoandroid monoandroid was computed. 
MonoMac monomac monomac was computed. 
MonoTouch monotouch monotouch was computed. 
Tizen tizen40 tizen40 was computed.  tizen60 tizen60 was computed. 
Xamarin.iOS xamarinios xamarinios was computed. 
Xamarin.Mac xamarinmac xamarinmac was computed. 
Xamarin.TVOS xamarintvos xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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.4.4-preview 78 6/16/2026
1.4.3-preview 84 6/15/2026
1.4.2 100 5/20/2026
1.4.1-preview 93 5/12/2026
1.4.0 102 5/6/2026
1.3.3-preview 86 5/5/2026
1.3.2-preview 97 4/29/2026
1.3.1-preview 99 4/28/2026
1.3.0-preview 98 4/27/2026
1.2.0-preview 102 3/29/2026
1.1.0 123 2/4/2026
1.0.3-preview 119 1/9/2026
1.0.2-preview 113 1/8/2026
1.0.0 325 11/12/2025
1.0.0-preview2 225 11/6/2025
1.0.0-preview1 221 11/5/2025
0.9.9 213 10/16/2025
0.9.8 211 10/14/2025
0.9.7-preview 196 10/13/2025
0.9.6-preview 169 10/12/2025
Loading failed