WebApi Extensions for ClosedXML
To install ClosedXML.Extensions.WebApi, run the following command in the Package Manager Console
PM> Install-Package ClosedXML.Extensions.WebApi
or
dotnet add package ClosedXML.Extensions.WebApi
In your WebApi controller define an action that will generate and download your file:
public class ExcelController : ApiController { [HttpGet] [Route("api/file/{id}")] public async Task<HttpResponseMessage> DownloadFile(int id) { var wb = await BuildExcelFile(id); return wb.Deliver("excelfile.xlsx"); } private async Task<XLWorkbook> BuildExcelFile(int id) { //Creating the workbook var t = Task.Run(() => { var wb = new XLWorkbook(); var ws = wb.AddWorksheet("Sheet1"); ws.FirstCell().SetValue(id); return wb; }); return await t; } }
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4