Yann.Npoi.Excel
1.0.260109.128-beta
.NET 6.0
This package targets .NET 6.0. The package is compatible with this framework or higher.
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
This is a prerelease version of Yann.Npoi.Excel.
dotnet add package Yann.Npoi.Excel --version 1.0.260109.128-beta
NuGet\Install-Package Yann.Npoi.Excel -Version 1.0.260109.128-beta
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="Yann.Npoi.Excel" Version="1.0.260109.128-beta" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Yann.Npoi.Excel" Version="1.0.260109.128-beta" />
<PackageReference Include="Yann.Npoi.Excel" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Yann.Npoi.Excel --version 1.0.260109.128-beta
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Yann.Npoi.Excel, 1.0.260109.128-beta"
#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.
#:package Yann.Npoi.Excel@1.0.260109.128-beta
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Yann.Npoi.Excel&version=1.0.260109.128-beta&prerelease
#tool nuget:?package=Yann.Npoi.Excel&version=1.0.260109.128-beta&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Yann.Npoi.Excel
基于 NPOI 的 Excel 导入导出帮助类核心库。支持插件式架构,可独立使用或配合 Yann.Npoi.Excel.Plugin 扩展。
功能特性
- ✅ 支持 List<T> 与 Excel 之间的导入导出
- ✅ 自动列宽调整
- ✅ 表头样式自动设置
- ✅ 支持多种数据类型(string, int, long, decimal, DateTime, bool, enum, Guid 等)
- ✅ 支持可空类型(int?, DateTime? 等)
- ✅ 插件式架构,可扩展自定义特性
- ✅ 多目标框架支持(.NET Standard 2.0/2.1, .NET 6.0/8.0)
安装
dotnet add package Yann.Npoi.Excel
快速开始
导出 Excel
using Yann.Npoi.Excel;
// 定义数据模型
public class UserModel
{
[DisplayName("用户ID")]
public int Id { get; set; }
[DisplayName("用户名")]
public string Name { get; set; }
[DisplayName("创建时间")]
public DateTime CreateTime { get; set; }
}
// 导出数据
var users = new List<UserModel>
{
new() { Id = 1, Name = "张三", CreateTime = DateTime.Now },
new() { Id = 2, Name = "李四", CreateTime = DateTime.Now }
};
byte[] excelBytes = users.ToExcelBytes();
File.WriteAllBytes("users.xlsx", excelBytes);
导入 Excel
using Yann.Npoi.Excel;
byte[] excelBytes = File.ReadAllBytes("users.xlsx");
List<UserModel> users = excelBytes.ExcelToList<UserModel>();
扩展功能
安装 Yann.Npoi.Excel.Plugin 包以使用更多功能:
- 下拉选择框 (
ExportDropDownAttribute) - 值映射 (
ExportValueMapAttribute) - 条件格式 (
ExportConditionalFormatAttribute) - 单元格警告 (
ExportCellWarningAttribute) - 原始文本导入 (
ImportRawTextAttribute)
dotnet add package Yann.Npoi.Excel.Plugin
许可证
MIT License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- DotNetCore.NPOI (>= 1.2.3)
- System.Memory (>= 4.5.5)
-
.NETStandard 2.1
- DotNetCore.NPOI (>= 1.2.3)
-
net6.0
- DotNetCore.NPOI (>= 1.2.3)
-
net8.0
- DotNetCore.NPOI (>= 1.2.3)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Yann.Npoi.Excel:
| Package | Downloads |
|---|---|
|
Yann.Npoi.Excel.Plugin
Yann.Npoi.Excel 的自定义特性扩展包。包含下拉选择(ExportDropDown)、值映射(ExportValueMap)、条件格式(ExportConditionalFormat)、单元格警告(ExportCellWarning)、原始文本导入(ImportRawText)等功能。 |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.260109.128-beta | 118 | 1/8/2026 |
| 1.0.260108.2002-beta | 87 | 1/8/2026 |