XlsxForge 1.1.3
dotnet add package XlsxForge --version 1.1.3
NuGet\Install-Package XlsxForge -Version 1.1.3
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="XlsxForge" Version="1.1.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="XlsxForge" Version="1.1.3" />
<PackageReference Include="XlsxForge" />
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 XlsxForge --version 1.1.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: XlsxForge, 1.1.3"
#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 XlsxForge@1.1.3
#: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=XlsxForge&version=1.1.3
#tool nuget:?package=XlsxForge&version=1.1.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
XlsxForge
Modern high-performance XLSX toolkit for .NET using OpenXML
Features
- Export —
List<T>,IEnumerable<T>,DataTable, multiple sheets - Import — XLSX to
List<T>with header-based property mapping - Streaming — 100k+ rows with
OpenXmlWriter(SAX mode) - Styling — Bold headers, fills, borders, date/number formats, wrap text
- Attributes —
[ExcelColumn],[ExcelFormat],[IgnoreColumn] - ASP.NET Core —
services.AddXlsxForge()+ endpoint extensions - High Performance — FastMember, RecyclableMemoryStream, async-friendly
- Clean API — No OpenXML types exposed publicly
Installation
dotnet add package XlsxForge
For ASP.NET Core integration:
dotnet add package XlsxForge.AspNetCore
Quick Start
Register Services
builder.Services.AddXlsxForge();
Define Your Model
using XlsxForge.Attributes;
public class Employee
{
[ExcelColumn("Employee Name", Order = 1)]
public string Name { get; set; } = string.Empty;
[ExcelColumn("Email Address", Order = 2)]
public string Email { get; set; } = string.Empty;
[ExcelColumn("Hire Date")]
[ExcelFormat("dd-MM-yyyy")]
public DateTime HireDate { get; set; }
[ExcelColumn("Salary")]
[ExcelFormat("#,##0.00")]
public decimal Salary { get; set; }
[IgnoreColumn]
public string InternalNotes { get; set; } = string.Empty;
}
Export to Excel
var bytes = await exporter.ExportAsync(employees, new ExcelExportOptions
{
SheetName = "Employees",
AutoFitColumns = true,
FreezeHeaderRow = true,
BoldHeaders = true
});
await File.WriteAllBytesAsync("employees.xlsx", bytes);
Import from Excel
using var stream = File.OpenRead("employees.xlsx");
var employees = await importer.ImportAsync<Employee>(stream);
Multi-Sheet Export
var sheets = new[]
{
ExcelSheet.Create("Employees", employees),
ExcelSheet.Create("Departments", departments),
};
var bytes = await exporter.ExportMultiSheetAsync(sheets);
Large Dataset Streaming (100k+ rows)
var largeExporter = serviceProvider.GetRequiredService<LargeFileExporter>();
var bytes = await largeExporter.ExportAsync(hugeDataset, new ExcelExportOptions
{
SheetName = "BigData"
});
🌐 ASP.NET Core Integration
Minimal API
app.MapGet("/api/export", async (IExcelExporter exporter) =>
{
var employees = GetEmployees();
return await exporter.ToExcelResult(employees, "employees-report");
});
Web API Controller
[HttpGet("export")]
public async Task<IActionResult> Export([FromServices] IExcelExporter exporter)
{
var data = await GetDataAsync();
var bytes = await exporter.ExportAsync(data);
return File(bytes, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "report.xlsx");
}
Export Options
| Property | Type | Default | Description |
|---|---|---|---|
SheetName |
string |
"Sheet1" |
Worksheet name |
AutoFitColumns |
bool |
true |
Auto-fit column widths |
FreezeHeaderRow |
bool |
true |
Freeze the header row |
BoldHeaders |
bool |
true |
Bold header text |
DateFormat |
string |
"yyyy-MM-dd" |
Default date format |
WrapText |
bool |
false |
Enable text wrapping |
EnableFilters |
bool |
false |
Add auto-filters |
NumberFormat |
string? |
null |
Default number format |
HeaderBackgroundColor |
string? |
"4472C4" |
Header background hex |
HeaderFontColor |
string? |
"FFFFFF" |
Header font color hex |
Architecture
XlsxForge
├── Interfaces/ → Public API contracts
├── Models/ → Options, sheet, column, cell models
├── Attributes/ → [ExcelColumn], [ExcelFormat], [IgnoreColumn]
├── Mapping/ → Reflection + FastMember property mapping
├── Styling/ → Stylesheet builder (fonts, fills, borders)
├── Exporting/ → Workbook generation orchestrator
├── Importing/ → Workbook reader + type converter
├── Streaming/ → OpenXmlWriter SAX-mode for large files
├── Helpers/ → Cell ref, column name, date conversions
├── Internal/ → RecyclableMemoryStream, TypeAccessor cache
├── Extensions/ → byte[], Stream, DataTable helpers
├── Exceptions/ → Custom exception hierarchy
├── Constants/ → Shared constants
└── DependencyInjection/ → services.AddXlsxForge()
Documentation
Testing
dotnet test XlsxForge.slnx
License
MIT © XlsxForge Contributors
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- DocumentFormat.OpenXml (>= 3.5.1)
- FastMember (>= 1.5.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.