zExcelGenerator 0.1.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package zExcelGenerator --version 0.1.0
NuGet\Install-Package zExcelGenerator -Version 0.1.0
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="zExcelGenerator" Version="0.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="zExcelGenerator" Version="0.1.0" />
<PackageReference Include="zExcelGenerator" />
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 zExcelGenerator --version 0.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: zExcelGenerator, 0.1.0"
#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 zExcelGenerator@0.1.0
#: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=zExcelGenerator&version=0.1.0
#tool nuget:?package=zExcelGenerator&version=0.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
📘 zExcelGenerator
A lightweight fluent API for generating Excel reports using ClosedXML.
Designed for clean, expressive, multi-sheet Excel report generation with support for simple and advanced column mappings.
📑 Table of Contents
✨ Features
- 🚀 Fluent API for building Excel reports
- 📄 Multi-worksheet support
- 🔢 Simple and advanced column mappings
- 🧩 Multiple-column and paired-column expansions
- ⚙️ Works with
ILogger<T> - ⏳ Supports
CancellationToken - 🌐 Compatible with
netstandard2.1
📦 Installation
dotnet add package zExcelGenerator
🚀 Quick Start
var logger = new NullLogger<ExcelGenerator>();
var generator = new ExcelGenerator(logger);
byte[] excelBytes = generator.GenerateExcel(workbook =>
{
workbook.AddWorksheet("People", people, ws => ws
.Column("Name", p => p.Name, 1)
.Column("Age", p => p.Age, 2)
.Column("Birth Date", p => p.BirthDate, 3, "dd/MM/yyyy")
);
});
📚 Usage Examples
Simple Columns
workbook.AddWorksheet("Products", products, ws => ws
.Column("Id", p => p.Id, 1)
.Column("Name", p => p.Name, 2)
.Column("Price", p => p.Price, 3, "#,##0.00")
);
Output
| Id | Name | Price |
|---|---|---|
| 1 | Monitor | 199.00 |
| 2 | Keyboard | 59.99 |
Multiple Worksheets
workbook
.AddWorksheet("People", people, ws => ws
.Column("Name", p => p.Name, 1)
.Column("Age", p => p.Age, 2))
.AddWorksheet("Orders", orders, ws => ws
.Column("Order #", o => o.OrderNumber, 1)
.Column("Total", o => o.TotalAmount, 2, "#,##0.00"));
Multiple Columns
workbook.AddWorksheet("Survey", surveyResults, ws => ws
.Column("Name", r => r.Name, 1)
.MultipleColumns(
description: "Score",
selector: r => r.Scores.Cast<object>(),
totalColumns: 3,
order: 2,
headerSuffix: new[] { "Q1", "Q2", "Q3" },
format: "0")
);
Output Example
| Name | Score Q1 | Score Q2 | Score Q3 |
|---|---|---|---|
| Ana | 5 | 4 | 3 |
Two Columns Per Field
workbook.AddWorksheet("Monthly", monthlyData, ws => ws
.TwoColumnsPerField(
firstDescription: "Planned",
secondDescription: "Actual",
firstSelector: d => d.Planned.Cast<object>(),
secondSelector: d => d.Actual.Cast<object>(),
totalColumns: 12,
order: 1,
firstHeaderSuffix: new[] { "Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec" },
secondHeaderSuffix: new[] { "Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec" },
firstFormat: "#,##0.00",
secondFormat: "#,##0.00")
);
Async & CancellationToken
var cts = new CancellationTokenSource(TimeSpan.FromSeconds(2));
byte[] excelBytes = await generator.GenerateExcelAsync(workbook =>
{
workbook.AddWorksheet("People", people, ws => ws
.Column("Name", p => p.Name, 1)
.Column("Age", p => p.Age, 2)
);
}, cts.Token);
Returning Excel from ASP.NET Core
return File(
excelBytes,
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"report.xlsx"
);
License
This project is licensed under the MIT License.
See the LICENSE file 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 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 | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | 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.
-
.NETStandard 2.1
- ClosedXML (>= 0.105.0)
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.