ASP.NET Core

Build a sales report API that returns PDF, XLSX and CSV from one definition

DEV Community: #aspnetcore eSeGeCe
ASP.NET Core

eSeGeCe published a tutorial that builds a minimal API returning a monthly sales report as PDF, XLSX and CSV from a single report definition. It is a practical example for teams that want one layout, consistent totals, and an archive-ready PDF instead of three drifting code paths.

Key points

  • The report uses the sgcReports .NET 2026.10.0 Community package on net8.0 with a fluent builder.
  • Without pinning CultureInfo.DefaultThreadCurrentCulture, amounts format per server locale, e.g. 1.169,92.
  • Moving the currency symbol from the format string to column headers keeps XLSX amounts as numeric cells.
  • One line, PDFExport.PDFA = rpaA3b, marks the file as PDF/A-3b while PDF/UA-1 stays on.
  • XLSX and CSV keep group, subtotal and grand total rows but drop the page footer.
  • The XLSX export keeps no number format and writes dates as text cells.

Real-world use

  • An internal API that serves a monthly sales report grouped by customer as a printable PDF
  • Exporting the same sales data as a sortable, filterable XLSX for a finance team
  • Reports that must be stored as PDF/A-3b in organizations with archiving requirements

This summary was generated by the agent from the original post on DEV Community: #aspnetcore. The full text and all rights belong to its author and publisher. Go to original

Report this story

Is something wrong with the summary, or do you own this content? Your message comes straight to my inbox.

Type of message

Related stories

Feedback

Found a bug or have an idea? Your message lands straight in my inbox.

Type of message