OLT.Extensions.EPPlus
8.2.0
Prefix Reserved
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 OLT.Extensions.EPPlus --version 8.2.0
NuGet\Install-Package OLT.Extensions.EPPlus -Version 8.2.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="OLT.Extensions.EPPlus" Version="8.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add OLT.Extensions.EPPlus --version 8.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: OLT.Extensions.EPPlus, 8.2.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 OLT.Extensions.EPPlus as a Cake Addin #addin nuget:?package=OLT.Extensions.EPPlus&version=8.2.0 // Install OLT.Extensions.EPPlus as a Cake Tool #tool nuget:?package=OLT.Extensions.EPPlus&version=8.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
- Converts IEnumerable<T> into an Excel worksheet/package
- Reads data from Excel packages and convert them into a List<T>.
How to Use
public class PersonDto
{
[ExcelTableColumn("First name")]
[Required(ErrorMessage = "First name cannot be empty.")]
[MaxLength(50, ErrorMessage = "First name cannot be more than {1} characters.")]
public string FirstName { get; set; }
[ExcelTableColumn(columnName = "Last name", isOptional = true)]
public string LastName { get; set; }
[ExcelTableColumn(3)]
[Range(1900, 2050, ErrorMessage = "Please enter a value bigger than {1}")]
public int YearBorn { get; set; }
public decimal NotMapped { get; set; }
[ExcelTableColumn(isOptional = true)]
public decimal OptionalColumn1 { get; set; }
[ExcelTableColumn(columnIndex=999, isOptional = true)]
public decimal OptionalColumn2 { get; set; }
}
- Converting from Excel to list of objects
// Direct usage:
excelPackage.ToList<PersonDto>(configuration => configuration.SkipCastingErrors());
// Specific worksheet:
excelPackage.GetWorksheet("Persons").ToList<PersonDto>();
- From a list of objects to Excel package
List<PersonDto> persons = new List<PersonDto>();
// Convert list into ExcelPackage
ExcelPackage excelPackage = persons.ToExcelPackage();
// Convert list into byte array
byte[] excelPackageXlsx = persons.ToXlsx();
// Generate ExcelPackage with configuration
List<PersonDto> pre50 = persons.Where(x => x.YearBorn < 1950).ToList();
List<PersonDto> post50 = persons.Where(x => x.YearBorn >= 1950).ToList();
ExcelPackage excelPackage = pre50.ToWorksheet("< 1950")
.WithConfiguration(configuration => configuration.WithColumnConfiguration(x => x.AutoFit()))
.WithColumn(x => x.FirstName, "First Name")
.WithColumn(x => x.LastName, "Last Name")
.WithColumn(x => x.YearBorn, "Year of Birth")
.WithTitle("< 1950")
.NextWorksheet(post50, "> 1950")
.WithColumn(x => x.LastName, "Last Name")
.WithColumn(x => x.YearBorn, "Year of Birth")
.WithTitle("> 1950")
.ToExcelPackage();
- Generating an Excel template from ExcelWorksheetAttribute marked classes
[ExcelWorksheet("Stocks")]
public class StocksDto
{
[ExcelTableColumn("SKU")]
public string Barcode { get; set; }
[ExcelTableColumn]
public int Quantity { get; set; }
}
// To ExcelPackage
ExcelPackage excelPackage = Assembly.GetExecutingAssembly().GenerateExcelPackage(nameof(StocksDto));
// To ExcelWorksheet
using(var excelPackage = new ExcelPackage()){
ExcelWorksheet worksheet = excelPackage.GenerateWorksheet(Assembly.GetExecutingAssembly(), nameof(StocksDto));
}
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 is compatible. 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.
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 |
---|---|---|
9.0.0 | 413 | 11/12/2024 |
8.2.0 | 13,199 | 10/6/2024 |
8.1.0 | 580 | 3/21/2024 |
8.0.0 | 530 | 12/20/2023 |
8.0.0-beta-0005 | 150 | 12/10/2023 |
1.0.0 | 539 | 5/5/2023 |
0.1.0-beta-0002 | 177 | 5/5/2023 |
0.1.0-beta-0001 | 1,431 | 8/25/2022 |