Yann.Npoi.Excel.Plugin 1.0.260109.128-beta

This is a prerelease version of Yann.Npoi.Excel.Plugin.
dotnet add package Yann.Npoi.Excel.Plugin --version 1.0.260109.128-beta
                    
NuGet\Install-Package Yann.Npoi.Excel.Plugin -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.Plugin" 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.Plugin" Version="1.0.260109.128-beta" />
                    
Directory.Packages.props
<PackageReference Include="Yann.Npoi.Excel.Plugin" />
                    
Project file
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.Plugin --version 1.0.260109.128-beta
                    
#r "nuget: Yann.Npoi.Excel.Plugin, 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.Plugin@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.Plugin&version=1.0.260109.128-beta&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Yann.Npoi.Excel.Plugin&version=1.0.260109.128-beta&prerelease
                    
Install as a Cake Tool

Yann.Npoi.Excel.Plugin

Yann.Npoi.Excel 的自定义特性扩展包。包含下拉选择、值映射、条件格式、单元格警告等功能。

安装

# 安装插件包(会自动安装核心包依赖)
dotnet add package Yann.Npoi.Excel.Plugin

功能特性

1. ExportDropDown - 下拉选择框

为 Excel 单元格添加下拉验证。

using Yann.Npoi.Excel.Plugin;

// 静态选项
[ExportDropDown("选项A", "选项B", "选项C")]
public string Category { get; set; }

// 动态选项(从 Provider 获取)
[ExportDropDown(typeof(MyProvider), nameof(MyProvider.GetOptions))]
public string Status { get; set; }

2. ExportValueMap - 值映射

导出时将属性值映射为显示文本,导入时反向映射。

[ExportValueMap(typeof(MyProvider), nameof(MyProvider.GetValueMap))]
public int StatusCode { get; set; }

// Provider 示例
public class MyProvider
{
    public static List<KeyValuePair<string, object>> GetValueMap(PropertyInfo prop, Type modelType)
    {
        return new List<KeyValuePair<string, object>>
        {
            new("启用", 1),
            new("禁用", 0)
        };
    }
}

3. ExportConditionalFormat - 条件格式

根据单元格值动态设置样式。

// 使用默认颜色
[ExportConditionalFormat(DefaultBackgroundColor = "#FFFF00")]
public string Name { get; set; }

// 使用动态格式提供器
[ExportConditionalFormat(typeof(MyFormatProvider), nameof(MyFormatProvider.GetFormat))]
public decimal Price { get; set; }

4. ExportCellWarning - 单元格警告

为单元格添加警告标记(批注和背景色)。

[ExportCellWarning(Author = "系统")]
public int Id { get; set; }

// 运行时设置警告
model.SetCellWarning(x => x.Id, "此字段有问题", "#FF0000");

5. ImportRawText - 原始文本导入

导入时保留单元格的原始文本值。

[ImportRawText]
public int Id { get; set; }

// 获取原始文本
var rawText = model.GetRawText(x => x.Id);

6. ValidateAndSeparate - 验证分离

自定义验证逻辑和错误处理。

许可证

MIT License

Product 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.

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.0.260109.128-beta 119 1/8/2026
1.0.260108.2002-beta 82 1/8/2026