Skip to content

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

@aioloswong

Description

@aioloswong

我导入的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://github.com/EPPlusSoftware/EPPlus/blob/develop/src/EPPlus/DataValidation/ExcelDataValidationWithFormula.cs
代码如下:
image
可以看到针对自定义公式类型进行了排除。

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions