ExcelXporter 1.0.3
dotnet add package ExcelXporter --version 1.0.3
NuGet\Install-Package ExcelXporter -Version 1.0.3
<PackageReference Include="ExcelXporter" Version="1.0.3" />
paket add ExcelXporter --version 1.0.3
#r "nuget: ExcelXporter, 1.0.3"
// Install ExcelXporter as a Cake Addin #addin nuget:?package=ExcelXporter&version=1.0.3 // Install ExcelXporter as a Cake Tool #tool nuget:?package=ExcelXporter&version=1.0.3
Feel free to post any suggestions or log any issue and enjoy exporting.
Just create any model list and pass this to the library and it will generate the excel for you in no time.
-------------------------------------------------------- Sample call if you have a single data list to export:
add namespace on top using ExcelXporter and use below - return objList.ExportToExcel("filename"); --------------------------------------------------------
-------------------------------------------------------- Sample call if you have a multiple data list to export:
add namespace on top using ExcelXporter and use below -
[HttpGet]
[Route("[action]")]
public IActionResult TestExportexcel()
{
List<TestModel> objList = new()
{
new TestModel ()
{
Id = 1,
Name = "John",
Email = "john.doe@gmail.com"
},
new TestModel
{
Id = 2,
Name = "Wick",
Email = "john.wick@gmail.com"
},
};
List<TestModel2> objList2 = new()
{
new TestModel2 ()
{
Id = 1,
Name = "John",
Email = "john.doe@gmail.com",
Address = "addr1"
},
new TestModel2
{
Id = 2,
Name = "Wick",
Email = "john.wick@gmail.com",
Address = "addr2"
},
new TestModel2
{
Id = 3,
Name = "Constantine",
Email = "c.wick@gmail.com",
Address = "addr3"
},
};
// This is the important part. You need to create a dynamic list object and add your list of different classes in it.
List<dynamic> listObj = new()
{
objList,
objList2
};
//now call the below extension method on the list created
return listObj.ExportToExcelMultipleSheets("filename");
}
Above return statement will export multiple data list and will create separate sheet for each list --------------------------------------------------------
Above code will download a excel.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. 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. |
-
net6.0
- AngleSharp (>= 1.0.7)
- DocumentFormat.OpenXml (>= 3.0.0)
- Microsoft.AspNetCore.Mvc.Core (>= 2.2.5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
* Now user can export multiple data list.
* Added new extension method to export multiple data list.
* Each data list will be in separate sheet in a single file.
* For single data list use the previous extension method only to avoid extra step.
* updated readme.