Jxls.Npoi
3.0.1
dotnet add package Jxls.Npoi --version 3.0.1
NuGet\Install-Package Jxls.Npoi -Version 3.0.1
<PackageReference Include="Jxls.Npoi" Version="3.0.1" />
<PackageVersion Include="Jxls.Npoi" Version="3.0.1" />
<PackageReference Include="Jxls.Npoi" />
paket add Jxls.Npoi --version 3.0.1
#r "nuget: Jxls.Npoi, 3.0.1"
#:package Jxls.Npoi@3.0.1
#addin nuget:?package=Jxls.Npoi&version=3.0.1
#tool nuget:?package=Jxls.Npoi&version=3.0.1
Jxls.Net
Jxls.Net is a C# / .NET port of JXLS 3.x for declarative Excel template-based report generation. Design your report layout, styles, charts, and formulas directly in Excel (.xlsx or .xls), annotate cells with jx:* comments, and fill them with .NET objects or dictionaries — no brittle cell-by-cell imperative code.
AI / LLM Agents: See
llms.txtfor a concise, single-file API and template syntax reference.
Features
- 100% Declarative Excel Templates:
jx:area,jx:each(select,orderBy,groupBy,direction="RIGHT",multisheet),jx:if(ifArea/elseArea),jx:grid,jx:updateCell,jx:mergeCells,jx:areaColumnMerge,jx:autoRowHeight,jx:image. - Automatic Excel Formula Expansion:
SUM(B3)automatically rewrites toSUM(B3:B102)after dynamic row/column expansion (StandardFormulaProcessor&FastFormulaProcessor). - Full
.xlsx,.xls, andSXSSFStreaming Support: Powered by NPOI 2.8.1 (Apache-2.0). - Sandboxed Expression Engine: Powered by DynamicExpresso.Core (MIT) — supports POCOs,
IDictionary<string, object?>,ExpandoObject, nested properties, arithmetic/ternary, and case-insensitive lookup (existing Java JXLS templates like${emp.name}work directly with C#Employee.Name). - Multi-Target:
netstandard2.0+net8.0(compatible with .NET Framework 4.8+ and .NET 6/8/9/10).
Installation
dotnet add package Jxls.Npoi
(Installing Jxls.Npoi automatically includes Jxls.Core.)
10-Line Quickstart
- In
template.xlsx:- Cell
A1comment:jx:area(lastCell="D4") - Cell
A3comment:jx:each(items="employees" var="emp" lastCell="D3") - Row 3 cells:
${emp.Name},${emp.Payment},${emp.Bonus},${emp.Payment + emp.Bonus} - Row 4 cells:
Total,=SUM(B3),=SUM(C3),=SUM(D3)
- Cell
- Fill the template in C#:
using System.Collections.Generic;
using Jxls.Builder;
using Jxls.Transform.Npoi;
var data = new Dictionary<string, object?>
{
["employees"] = new[]
{
new { Name = "Alice", Payment = 3000m, Bonus = 450m },
new { Name = "Bob", Payment = 2500m, Bonus = 250m }
}
};
JxlsNpoiTemplateFillerBuilder.NewInstance()
.WithTemplate("template.xlsx")
.BuildAndFill(data, new JxlsOutputFile("output.xlsx"));
Quick Grid Export (No Template File Needed)
using Jxls.Template;
var headers = new List<string> { "Name", "Payment", "Bonus" };
using var output = File.Create("export.xlsx");
SimpleExporter.GridExport(headers, employees, "Name,Payment,Bonus", output);
Supported Template Commands
| Command | Purpose | Example |
|---|---|---|
jx:area |
Defines root template area | jx:area(lastCell="D4") |
jx:each |
Iterates collections (rows, columns, multi-sheet, grouping, sorting, filtering) | jx:each(items="emps" var="e" lastCell="D3" select="e.Active" orderBy="e.Name ASC") |
jx:if |
Conditional rendering with optional else area |
jx:if(condition="e.Payment >= 2000" lastCell="C3" areas=["A3:C3","A4:C4"]) |
jx:grid |
Dynamic headers + rows grid | jx:grid(headers="headers" data="rows" props="Name,Payment" lastCell="A2") |
jx:mergeCells |
Dynamic cell merging | jx:mergeCells(lastCell="C2" cols="3") |
jx:image |
Embeds PNG/JPEG/EMF/WMF images from byte[] |
jx:image(src="logo" imageType="PNG" lastCell="B4") |
jx:autoRowHeight |
Auto-adjusts row height | jx:autoRowHeight(lastCell="D3") |
jx:updateCell |
Custom cell transformation hook (ICellDataUpdater) |
jx:updateCell(updater="myUpdater" lastCell="B3") |
Building & Testing
dotnet build Jxls.Net.sln --configuration Release
dotnet test Jxls.Net.sln --configuration Release
Attribution & License
Jxls.Net is a C# / .NET port derived from jxlsteam/jxls. Licensed under the Apache License, Version 2.0. See LICENSE and NOTICE for details.
| 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 is compatible. 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. |
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.