- Notifications
You must be signed in to change notification settings - Fork16
License
NotificationsYou must be signed in to change notification settings
ClosedXML/ClosedXML.Extensions.WebApi
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
WebApi Extensions forClosedXML
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:
publicclassExcelController:ApiController{[HttpGet][Route("api/file/{id}")]publicasyncTask<HttpResponseMessage>DownloadFile(intid){varwb=awaitBuildExcelFile(id);returnwb.Deliver("excelfile.xlsx");}privateasyncTask<XLWorkbook>BuildExcelFile(intid){//Creating the workbookvart=Task.Run(()=>{varwb=newXLWorkbook();varws=wb.AddWorksheet("Sheet1");ws.FirstCell().SetValue(id);returnwb;});returnawaitt;}}
About
No description, website, or topics provided.
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.
Contributors3
Uh oh!
There was an error while loading.Please reload this page.