MH.Excel.Export
1.7.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package MH.Excel.Export --version 1.7.0
NuGet\Install-Package MH.Excel.Export -Version 1.7.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MH.Excel.Export" Version="1.7.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MH.Excel.Export --version 1.7.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MH.Excel.Export, 1.7.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MH.Excel.Export as a Cake Addin #addin nuget:?package=MH.Excel.Export&version=1.7.0 // Install MH.Excel.Export as a Cake Tool #tool nuget:?package=MH.Excel.Export&version=1.7.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
MH.Excel.Export
MH.Excel.Export
is a multi-level Excel (.xlsx) generator for ASP.NET Core applications.
Install via NuGet
To install MH.Excel.Export
, run the following command in the Package Manager Console:
PM> Install-Package MH.Excel.Export
You can also view the package page on NuGet.
Usage:
After installing the MH.Excel.Export package, you can send any classes with/without [Display(Name ="")]
attribute and get required data for pass to return File();
public async Task<IActionResult> Simple()
{
var list = new TestClass().GetList();
var excel = await ExportManager.ExportToXlsxAsync(list, "Test Simple Excel");
return File(excel.FileContents, excel.ContentType, excel.FileDownloadName);
}
public async Task<IActionResult> ExportWithSubClass()
{
var list = new TestClass().GetList();
var excel = await ExportManager.ExportToXlsxAsync<TestClass, TestClass.SubClassTest>(list, "Test 2 Level Excel");
return File(excel.FileContents, excel.ContentType, excel.FileDownloadName);
}
TestClass
public class TestClass
{
[Display(Name = "Id")]
public int Id { get; set; }
[Display(Name = "First Name")]
public string Name { get; set; }
[Display(Name = "Last Name")]
public string Name2 { get; set; }
[Display(Name = "Items")]
public List<SubClassTest> List { get; set; } = new();
public List<TestClass> GetList()
{
var tests = new List<TestClass>();
for (int i = 1; i < 10; i++)
{
var test = new TestClass
{
Id = i,
Name = $"Name - {i}",
Name2 = $"Name2 - {i}",
};
for (int j = 1; j < 10; j++)
{
test.List.Add(new SubClassTest
{
Id = 50 * j,
Type = $"Type - {j}",
Type2 = $"Type2 - {j}",
Type3 = $"Type3 - {j}"
});
}
tests.Add(test);
}
return tests;
}
public class SubClassTest
{
[Display(Name = "Id")]
public int Id { get; set; }
[Display(Name = "attr1")]
public string Type { get; set; }
[Display(Name = "attr2")]
public string Type2 { get; set; }
[Display(Name = "attr3")]
public string Type3 { get; set; }
}
}
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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net7.0
- EPPlus (>= 6.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.