dotnetcore / dotnetcore/Magicodes.IE

Excel导入数据有效性不支持自定义公式验证

Open
#208 1 comment 0 reactions 0 assignees View on GitHub
area-excel
Dominant language
C#
Stars
2.2k
Forks
495
PR merge metrics
No merged PRs in 30d

Description

我导入的excel的一列为手机号,设置了数据有效性的自定义公式为=AND(ISNUMBER(D2),LEN(D2)=11),导入的时候报一下错误:
Validation of xxxx failed: Formula2 must be set if operator is 'between' or 'notBetween'。

问题的原因在与Magicodes.IE引用的包Magicodes.EPPlus的OfficeOpenXml.DataValidation的 ExcelDataValidationWithFormula类的Validate方法,出问题的代码如下图:
![image](https://user-images.githubusercontent.com/10336303/101730980-ea770800-3af5-11eb-806b-94b6e9047cb9.png)

最新的官方的原始版的代码如下在
https://github.com/EPPlusSoftware/EPPlus/blob/develop/src/EPPlus/DataValidation/ExcelDataValidationWithFormula.cs
代码如下:
![image](https://user-images.githubusercontent.com/10336303/101731634-e0a1d480-3af6-11eb-9192-5827f3d4497b.png)
可以看到针对自定义公式类型进行了排除。

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.