Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

License

NotificationsYou must be signed in to change notification settings

ClosedXML/ClosedXML.Extensions.WebApi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WebApi Extensions forClosedXML

Install via NuGet

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

Usage

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

Stars

Watchers

Forks

Packages

No packages published

Contributors3

  •  
  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp