FluentNPOI 2.3.0
dotnet add package FluentNPOI --version 2.3.0
NuGet\Install-Package FluentNPOI -Version 2.3.0
<PackageReference Include="FluentNPOI" Version="2.3.0" />
<PackageVersion Include="FluentNPOI" Version="2.3.0" />
<PackageReference Include="FluentNPOI" />
paket add FluentNPOI --version 2.3.0
#r "nuget: FluentNPOI, 2.3.0"
#:package FluentNPOI@2.3.0
#addin nuget:?package=FluentNPOI&version=2.3.0
#tool nuget:?package=FluentNPOI&version=2.3.0
FluentNPOI
FluentNPOI is a fluent wrapper for NPOI that provides an intuitive and easy-to-use API for reading and writing Excel files.
🚀 Features
- ✅ Fluent API - Chained method calls for simpler, readable code
- ✅ Strongly Typed Mapping - Use
FluentMappingfor type-safe data binding - ✅ Modular Packages - Install only what you need: Core, PDF, Streaming, Charts
- ✅ Direct Styling - Configure styles directly within Mapping or FluentCell API
- ✅ Style Management - Smart caching to handle duplicate styles
- ✅ Comprehensive I/O - Read/Write, Images, Formulas, Merging
- ✅ HTML/PDF Export - Convert Excel to HTML or PDF
- ✅ Chart Generation - Generate charts using ScottPlot and embed in Excel
- ✅ Hot Reload - Live preview changes with
dotnet watchand LibreOffice (requires LibreOffice)
📦 Installation
Core Package
dotnet add package FluentNPOI
Optional Modules
| Package | Purpose | Install |
|---|---|---|
FluentNPOI.Pdf |
PDF Export (QuestPDF) | dotnet add package FluentNPOI.Pdf |
FluentNPOI.Streaming |
Large File Streaming | dotnet add package FluentNPOI.Streaming |
FluentNPOI.Charts |
Chart Generation (ScottPlot) | dotnet add package FluentNPOI.Charts |
FluentNPOI.HotReload |
Live Preview (Dev only) | dotnet add package FluentNPOI.HotReload |
FluentNPOI.All |
Full Features (All modules) | dotnet add package FluentNPOI.All |
🎯 Quick Start
1. Basic Write
using FluentNPOI;
using NPOI.XSSF.UserModel;
var workbook = new XSSFWorkbook();
var fluent = new FluentWorkbook(workbook);
fluent.UseSheet("Sheet1")
.SetCellPosition(ExcelCol.A, 1)
.SetValue("Hello World!")
.SetBackgroundColor(IndexedColors.Yellow)
.SetFont(isBold: true, fontSize: 14);
fluent.SaveToPath("output.xlsx");
2. Table Binding with FluentMapping (Recommended)
var mapping = new FluentMapping<Student>();
mapping.Map(x => x.Name)
.ToColumn(ExcelCol.A)
.WithTitle("Name")
.WithBackgroundColor(IndexedColors.LightCornflowerBlue);
mapping.Map(x => x.Score)
.ToColumn(ExcelCol.B)
.WithTitle("Score")
.WithNumberFormat("0.0");
fluent.UseSheet("Report")
.SetTable(data, mapping)
.BuildRows()
.SetAutoFilter()
.FreezeTitleRow();
3. Streaming for Large Files
using FluentNPOI.Streaming;
StreamingBuilder<DataModel>.FromFile("large_input.xlsx")
.Transform(x => x.Value *= 2)
.WithMapping(mapping)
.SaveAs("output.xlsx");
4. Chart Generation
using FluentNPOI.Charts;
// Integrated chaining API
fluent.UseSheet("Charts")
.SetCellPosition(ExcelCol.A, 1)
.AddBarChart(data, chart => {
chart.X(d => d.Category)
.Y(d => d.Value)
.WithTitle("Sales Report");
}, width: 400, height: 300);
// Or generate manually
var chartBytes = ChartBuilder.Bar(data)
.X(d => d.Category)
.Y(d => d.Value)
.Configure(plot => {
// Full access to ScottPlot API
plot.FigureBackground.Color = ScottPlot.Colors.White;
})
.ToPng(400, 300);
5. PDF Export
using FluentNPOI.Pdf;
PdfConverter.ConvertSheetToPdf(fluent.UseSheet("Report"), "report.pdf");
6. Live Preview (Hot Reload)
Ensure FluentNPOI.HotReload and LibreOffice are installed.
Code Implementation
Wrap your generation logic with FluentLivePreview.Run:
using FluentNPOI.HotReload;
// ... inside your Main method or setup
FluentLivePreview.Run("output/report.xlsx", fluent =>
{
// Your FluentNPOI code goes here
fluent.UseSheet("Sheet1")
.SetCellPosition(ExcelCol.A, 1)
.SetValue("Live Update!")
.SetBackgroundColor(IndexedColors.LightGreen);
});
Run with dotnet watch
# Run in your Console project directory
dotnet watch run
Changes to your code will automatically trigger a reload and show the latest result in LibreOffice.
📖 API Overview
| Area | Key Methods |
|---|---|
| Mapping | Map, ToColumn, WithTitle, WithNumberFormat, WithBackgroundColor |
| Cell | SetValue, SetFormula, SetBackgroundColor, SetBorder, SetFont |
| Table | SetTable, BuildRows, SetAutoFilter, FreezeTitleRow, AutoSizeColumns |
| Streaming | StreamingBuilder.FromFile, Transform, SaveAs |
| Charts | AddBarChart, AddLineChart, AddPieChart, ChartBuilder |
| HotReload | FluentLivePreview.Run |
🤝 Contribution
Issues and Pull Requests are welcome!
📄 License
MIT License - See LICENSE file.
| Product | Versions 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 was computed. |
| .NET Framework | net461 was computed. 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. |
-
.NETStandard 2.0
- Microsoft.CSharp (>= 4.7.0)
- NPOI (>= 2.7.1)
- System.Drawing.Common (>= 8.0.0)
NuGet packages (5)
Showing the top 5 NuGet packages that depend on FluentNPOI:
| Package | Downloads |
|---|---|
|
FluentNPOI.All
Complete FluentNPOI package bundle including all extension modules (PDF, Streaming, Charts). |
|
|
FluentNPOI.Charts
Chart generation extension for FluentNPOI using ScottPlot. |
|
|
FluentNPOI.Pdf
PDF export extension for FluentNPOI using QuestPDF. |
|
|
FluentNPOI.Streaming
Streaming read extension for FluentNPOI using ExcelDataReader for large file processing. |
|
|
FluentNPOI.HotReload
Hot Reload extension for FluentNPOI with declarative widget-based Excel development and LibreOffice live preview support. |
GitHub repositories
This package is not used by any popular GitHub repositories.