DoIt.ExcelWriter.AspNetCore
1.2.2
dotnet add package DoIt.ExcelWriter.AspNetCore --version 1.2.2
NuGet\Install-Package DoIt.ExcelWriter.AspNetCore -Version 1.2.2
<PackageReference Include="DoIt.ExcelWriter.AspNetCore" Version="1.2.2" />
paket add DoIt.ExcelWriter.AspNetCore --version 1.2.2
#r "nuget: DoIt.ExcelWriter.AspNetCore, 1.2.2"
// Install DoIt.ExcelWriter.AspNetCore as a Cake Addin #addin nuget:?package=DoIt.ExcelWriter.AspNetCore&version=1.2.2 // Install DoIt.ExcelWriter.AspNetCore as a Cake Tool #tool nuget:?package=DoIt.ExcelWriter.AspNetCore&version=1.2.2
DoIt.ExcelWriter.AspNetCore
Extensions for simplifying usage of the "forward only" Excel writer DoIt.ExcelWriter from ASP.NET Core applications.
What's this?
If you want to use DoIt.ExcelWriter to generate Excel files in an ASP.NET Core application, this library contains extension methods for simplifying this.
Alright, how do I use it?
First of all, you need to add the library to yout ASP.NET Core project
dotnet add package DoIt.ExcelWriter.AspNetCore
Note that you do not need any package reference to the DoIt.ExcelWriter
package – that package is brought in when DoIt.ExcelWriter.AspNetCore
is references.
Once the package is added to you ASP.NET Core project, a ExcelContent()
extension method creating an IActionResult
becomes available for use in your controller actions. This extension will write your generated Excel data to the response body in a memory efficient manner and set the Content-Type
header to the correct value.
You may also pass a file name which will be sent in the Content-Disposition
HTTP response header.
using Microsoft.AspNetCore.Mvc;
record ExcelRow(int Id, string FirstName, string LastName);
public class DefaulController : Controller
{
[HttpGet]
public IActionResult GenerateExcel()
{
return this.ExcelContent(async writer =>
{
await (var sheet = await writer.AddSheetAsync<ExcelRow>("Sheet1", HttpContext.RequestAborted))
{
await sheet.WriteAsync(new ExcelRow(1, "Foo", "Bar"), HttpContext.RequestAborted);
}
});
}
}
What else?
That's pretty much it! For more information on how to actually generate Excel files using the DoIt.ExcelWriter
library, please check out that library's Github repository.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net7.0
- DoIt.ExcelWriter (>= 1.2.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.2.2 | 1,399 | 3/7/2023 |