Simple.ExportToExcel
2.0.2
See the version list below for details.
dotnet add package Simple.ExportToExcel --version 2.0.2
NuGet\Install-Package Simple.ExportToExcel -Version 2.0.2
<PackageReference Include="Simple.ExportToExcel" Version="2.0.2" />
<PackageVersion Include="Simple.ExportToExcel" Version="2.0.2" />
<PackageReference Include="Simple.ExportToExcel" />
paket add Simple.ExportToExcel --version 2.0.2
#r "nuget: Simple.ExportToExcel, 2.0.2"
#:package Simple.ExportToExcel@2.0.2
#addin nuget:?package=Simple.ExportToExcel&version=2.0.2
#tool nuget:?package=Simple.ExportToExcel&version=2.0.2
Simple Blazor Export-To-Excel Component
Simple Blazor Component that will export data as an Excel spreadsheet (.xlsx).
Dependencies:
- NPOI 2.8.0
Requirements:
- .NET 10.0
Installation:
Register the required services in your Program.cs:
builder.Services.AddExportToExcel();
Component Parameters:
| Parameter | Type | Description |
|---|---|---|
TValue |
generic | Type of object being exported |
RequestDelegate |
Func<IEnumerable<TValue>> |
Method that retrieves the data to export |
ButtonText |
object |
Text displayed on the export button |
ButtonClass |
string |
CSS class for the export button (default: btn btn-outline-success) |
ButtonStyle |
string |
Inline CSS style for the export button |
ButtonTitle |
string |
Tooltip text on the export button (default: Export To Excel) |
The component renders color and alignment pickers for both the header and body rows, and a filename input. The spreadsheet is generated and downloaded when the form is submitted.
Example:
<ExcelExport ButtonText="Export Weather Data"
ButtonClass="btn btn-outline-success"
TValue="WeatherForecast"
RequestDelegate="GetData" />
@code {
WeatherForecast[] forecasts;
[Inject] WeatherForecastService ForecastService { get; set; }
protected override async Task OnInitializedAsync()
{
forecasts = await ForecastService.GetForecastAsync(DateTime.Now);
}
IEnumerable<WeatherForecast> GetData() => forecasts ?? Enumerable.Empty<WeatherForecast>();
}
Column Mapping:
By default, columns are generated from properties decorated with [Display(Name="...")]. Properties without the attribute fall back to the property name.
For explicit control over column order and names, decorate your class with [SpreadSheet] and properties with [SpreadSheetColumn]:
[SpreadSheet("WeatherForecast", typeof(WeatherForecast))]
public class WeatherForecast
{
[SpreadSheetColumn("Date", 0)]
public DateTime Date { get; set; }
[SpreadSheetColumn("Temperature (C)", 1)]
public int TemperatureC { get; set; }
[SpreadSheetColumn("Summary", 2)]
public string Summary { get; set; }
}
Contributions
Thank you to Andre' Rizzato for discovering an implementation issue and providing a working solution.
Change Log
[Version 2.0.0]
- Changed how cell value is set so that the correct type is used. Type integer was causing formatting warnings in the exported Excel file
- Updated to .NET 10.0
- Migrated to Central Package Management (CPM)
- Fixed concurrency bug where static cell style fields in
BodyBuildercould corrupt styles across concurrent exports - Fixed
async voidon export handler to properly propagate exceptions - Fixed
IndexOutOfRangeExceptionwhen list sub-properties or reflected properties lack a[Display]attribute - Fixed foreground color selection not being applied to the generated spreadsheet
[Version 1.1.0.0]
- Changed parameters in ExcelExport component
CssClass⇒ButtonClassReportName⇒ removedTitle⇒ButtonTitleButtonStyle⇒ added for inline styling
- Changed styling of input fields
- Added validation to filename input field
- Updated to .NET 6.0
| 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. |
-
net10.0
- Microsoft.AspNetCore.Components.Web (>= 10.0.7)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.7)
- NPOI (>= 2.8.0)
- SixLabors.ImageSharp (>= 3.1.12)
- System.Security.Cryptography.Xml (>= 10.0.7)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.5 | 23 | 5/8/2026 |
| 2.0.4 | 20 | 5/8/2026 |
| 2.0.3 | 26 | 5/8/2026 |
| 2.0.2 | 25 | 5/8/2026 |
| 2.0.1 | 25 | 5/8/2026 |
| 2.0.0 | 38 | 5/7/2026 |
| 1.1.0.1 | 803 | 7/26/2022 |
| 1.1.0 | 570 | 7/20/2022 |
| 1.0.0.5 | 678 | 11/10/2020 |
| 1.0.0.4 | 612 | 11/10/2020 |
| 1.0.0.3 | 611 | 11/10/2020 |
| 1.0.0.2 | 371 | 11/10/2020 |
| 1.0.0.1 | 449 | 11/10/2020 |
| 1.0.0 | 451 | 11/10/2020 |