Simple.ExportToExcel 2.0.2

There is a newer version of this package available.
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
                    
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="Simple.ExportToExcel" Version="2.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Simple.ExportToExcel" Version="2.0.2" />
                    
Directory.Packages.props
<PackageReference Include="Simple.ExportToExcel" />
                    
Project file
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 Simple.ExportToExcel --version 2.0.2
                    
#r "nuget: Simple.ExportToExcel, 2.0.2"
                    
#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 Simple.ExportToExcel@2.0.2
                    
#: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=Simple.ExportToExcel&version=2.0.2
                    
Install as a Cake Addin
#tool nuget:?package=Simple.ExportToExcel&version=2.0.2
                    
Install as a Cake Tool

Simple Blazor Export-To-Excel Component

Simple Blazor Component that will export data as an Excel spreadsheet (.xlsx).

Dependencies:

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 BodyBuilder could corrupt styles across concurrent exports
  • Fixed async void on export handler to properly propagate exceptions
  • Fixed IndexOutOfRangeException when 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
    • CssClassButtonClass
    • ReportName ⇒ removed
    • TitleButtonTitle
    • ButtonStyle ⇒ added for inline styling
  • Changed styling of input fields
  • Added validation to filename input field
  • Updated to .NET 6.0
Product 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.

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