PandaTech.FileExporter 5.0.3

dotnet add package PandaTech.FileExporter --version 5.0.3
                    
NuGet\Install-Package PandaTech.FileExporter -Version 5.0.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="PandaTech.FileExporter" Version="5.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PandaTech.FileExporter" Version="5.0.3" />
                    
Directory.Packages.props
<PackageReference Include="PandaTech.FileExporter" />
                    
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 PandaTech.FileExporter --version 5.0.3
                    
#r "nuget: PandaTech.FileExporter, 5.0.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 PandaTech.FileExporter@5.0.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=PandaTech.FileExporter&version=5.0.3
                    
Install as a Cake Addin
#tool nuget:?package=PandaTech.FileExporter&version=5.0.3
                    
Install as a Cake Tool

PandaTech.FileExporter

Blazing‑fast, flexible, convention‑first CSV/XLSX exporter for .NET 9+
Powered internally by two battle‑tested libraries:\

  • CsvHelper --- industry‑standard CSV writer\
  • SpreadCheetah --- extremely fast, fully streaming XLSX generator

PandaTech.FileExporter focuses on performance, stability, and developer happiness.
Version 5.x is a complete redesign of 4.x --- simpler, safer, faster. API is fully modernized (minimal APIs, DI‑friendly, async‑ready).

⚠️ Breaking Change Notice
v5 breaks compatibility with v4. Migration is straightforward: - enums changed values --- do not reuse v4 enum values - PDF support removed (too slow, not worth maintaining) - All exporters rebuilt around a simpler, more predictable format system


✨ Features

  • Convention‑based export (zero config)\
  • Fluent export rules via ExportRule<T>\
  • Super‑fast XLSX via SpreadCheetah (safe for millions of rows)\
  • CSV export using CsvHelper\
  • Automatic ZIP compression when file size is large\
  • Multi‑sheet XLSX for datasets > 1M rows\
  • Async streaming support (IAsyncEnumerable<T>)\
  • Custom formatting & transforms\
  • Minimal API ready\
  • Simple DI registration\
  • No controllers required

🚀 Installation

dotnet add package PandaTech.FileExporter

⚙️ Quick Start

1. Configure in Program.cs

var builder = WebApplication.CreateBuilder(args);

builder.AddFileExporter(); // scans entry assembly for ExportRule<T>

2. Export from your endpoint

app.MapGet("/export", async () =>
{
    var data = new List<MyRow>
    {
        new() { Id = 1, Name = "Alice" },
        new() { Id = 2, Name = "Bob" }
    };

    var file = await data.ToFileFormatAsync(ExportFormat.Xlsx);
    return file.ToFileResult();
});

Done. Zero configuration required.


📄 Defining Custom Rules (Optional)

using FileExporter.Rules;

public sealed class MyRowExportRule : ExportRule<MyRow>
{
    public MyRowExportRule()
    {
        WithName("My Custom Export");

        RuleFor(x => x.Id)
            .HasOrder(0)
            .HasFormat(ColumnFormatType.Integer);

        RuleFor(x => x.Name)
            .HasOrder(1)
            .WriteToColumn("Full Name");
    }
}

Just add this class; it will be auto‑discovered.


🔍 Supported Formats

ExportFormat Description


Csv UTF‑8 CSV, auto‑quote, stable for huge datasets Xlsx Multi‑sheet, streaming, low memory usage


📦 File Naming

Every file receives a timestamp:

Orders 2025-01-01 10:33:00.xlsx

Automatically sanitized for safety.


🔧 Property Rule Options


Option Description


WriteToColumn("Name") Override header text

HasOrder(1) Column ordering

Ignore() Exclude property

HasFormat(...) Text, Integer, Decimal, Currency, Percentage, Boolean, Date, DateTime

HasPrecision(2) Decimal digit precision (not rounding, for rounding refer .Transform())

HasWidth(20) XLSX column width override

WithDefaultValue("N/A") Replaces null values

Transform(v => ...) Custom transformation


🧬 Enum Formatting

Rules support:

  • MixedIntAndName (default)"1 - Active"
  • Int"1"
  • Name"Active"

🔥 Performance Notes

  • Handles millions of rows with constant memory usage\
  • XLSX splits automatically into multiple sheets\
  • ZIP is only applied when final file exceeds threshold\
  • Async pipelines (IAsyncEnumerable<T>) supported

🪄 Tips

  • Keep DTOs simple; exporters use reflection only once\
  • Add custom rules only for overrides --- conventions already cover:
    • ordering\
    • decimal precision\
    • date formatting\
    • booleans\
  • For extremely large exports: prefer IAsyncEnumerable<T>

🧭 Demo

app.MapGet("/export/orders", async (ExportFormat format) =>
{
    var orders = Enumerable.Range(1, 2000000)
        .Select(i => new OrderDto { Id = i, Total = i * 1.25m });

    var file = await orders.ToFileFormatAsync(format);
    return file.ToFileResult();
});

Exports 2M rows in under a few seconds (depending on disk/CPU).


🏁 Conclusion

PandaTech.FileExporter is built to stay small, clean, and blazing fast.
If you need CSV/XLSX export without pain --- you're covered.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on PandaTech.FileExporter:

Package Downloads
Pandatech.SharedKernel

Pandatech.SharedKernel provides centralized configurations, utilities, and extensions for ASP.NET Core projects. For more information refere to readme.md document.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
5.0.3 171 12/5/2025
5.0.2 180 12/4/2025
5.0.1 185 12/4/2025
5.0.0 662 12/1/2025
4.1.2 241 8/16/2025
4.1.1 159 8/16/2025
4.1.0 157 8/16/2025
4.0.7 252 8/7/2025
4.0.6 243 6/1/2025
4.0.5 202 6/1/2025
4.0.4 188 5/19/2025
4.0.3 201 4/11/2025
4.0.2 294 3/10/2025
4.0.1 205 2/17/2025
4.0.0 403 11/21/2024
3.3.3 194 10/18/2024
3.3.2 213 8/27/2024
3.3.1 208 8/23/2024
3.3.0 190 8/23/2024
3.2.0 207 7/19/2024
3.1.1 185 6/28/2024
3.1.0 182 6/28/2024
3.0.10 196 6/28/2024
3.0.9 179 6/21/2024
3.0.8 201 5/13/2024
3.0.7 154 5/2/2024
3.0.6 177 4/29/2024
3.0.5 164 4/29/2024
3.0.4 178 4/26/2024
3.0.3 190 4/26/2024
3.0.2 196 4/26/2024
3.0.1 188 4/26/2024
3.0.0 192 4/26/2024
2.0.2 217 4/4/2024

Xlsx table style sheet has been removed.