GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - HouseAlwaysWin/FluentNPOI: A fluent API wrapper for NPOI. Read/write Excel with chainable methods, strong typing, style caching, and dynamic formatting.

BranchesTags
Open more actions menu

Latest commit

 

History

180 Commits
180 Commits

Folders and files

NameName
Last commit message
Last commit date
.agent
.agent
 
 
.github
.github
 
 
FluentNPOI.All
FluentNPOI.All
 
 
FluentNPOI.Charts
FluentNPOI.Charts
 
 
FluentNPOI.HotReload
FluentNPOI.HotReload
 
 
FluentNPOI.Pdf
FluentNPOI.Pdf
 
 
FluentNPOI.Streaming
FluentNPOI.Streaming
 
 
FluentNPOI
FluentNPOI
 
 
FluentNPOIConsoleExample
FluentNPOIConsoleExample
 
 
FluentNPOIUnitTest
FluentNPOIUnitTest
 
 
scripts
scripts
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
Directory.Build.props
Directory.Build.props
 
 
Directory.Packages.props
Directory.Packages.props
 
 
FluentNPOI.code-workspace
FluentNPOI.code-workspace
 
 
FluentNPOI.sln
FluentNPOI.sln
 
 
LICENSE
LICENSE
 
 
QUICK_REFERENCE.md
QUICK_REFERENCE.md
 
 
README.md
README.md
 
 
README.zh-TW.md
README.zh-TW.md
 
 
build.ps1
build.ps1
 
 
push-to-github.ps1
push-to-github.ps1
 
 
setup-config.ps1
setup-config.ps1
 
 

Repository files navigation

FluentNPOI

CI .NET Standard 2.0 License: MIT

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 FluentMapping for 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 watch and 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.

About

A fluent API wrapper for NPOI. Read/write Excel with chainable methods, strong typing, style caching, and dynamic formatting.

www.nuget.org/packages?q=FluentNPOI

Topics

csharpdotnetexcelfluent-apihtmlnpoiquestpdfxlsx

Resources

Readme
MIT license

Contributing

Contributing
Activity

Stars

5 stars

Watchers

1 watching

Forks

1 fork
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.