Menu

Build a Sales Report API in ASP.NET Core with PDF, XLSX and CSV
📰

Build a Sales Report API in ASP.NET Core with PDF, XLSX and CSV

DEV Community: dotnet·eSeGeCe·6 days ago
#tuXCKFIm
#devtodotnet#devto#dev#month#report
Reading 0:00
15s threshold

Sooner or later, most business apps need the same two things: a report someone can print, send or archive, and a spreadsheet with the same numbers that someone else can sort and filter. If you build them in two separate code paths, they drift apart. A total gets rounded differently, a column goes missing, a month filter behaves slightly differently.

In this tutorial you build a small ASP.NET Core minimal API that generates a monthly sales report on the server and returns it as PDF, XLSX or CSV from one report definition. The report groups orders by customer, prints a subtotal per customer and a grand total, takes the month from the query string, marks the PDF as PDF/A-3b with one extra line, and saves its layout to JSON so you can load it back later.

The report engine is sgcReports .NET, a headless engine with bands, expressions, data sources, pagination and PDF, XLSX, CSV and PNG export. You'll use the free Community package from nuget.org.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.