电子邮件地址约束电子邮件列

 string emailValidationFormula = GetEmailValidationFormula(targetFirstCol);
 CellRangeAddressList cellRangeFieldsType5 = new CellRangeAddressList(1, DVRowLimit, targetFirstCol, targetLastCol);
     dvConstraint = (XSSFDataValidationConstraint)validationHelper.CreateCustomConstraint(emailValidationFormula)

//获取电子邮件地址验证模式私有字符串 GetEmailValidationFormula(int targetColumn){

    int div = headerCount + 1;
    string colLetter = String.Empty;
    int mod = 0;

    try
    {
        while (div > 0)
        {
            mod = (div - 1) % 26;
            colLetter = (char)(65 + mod) + colLetter;
            div = (int)((div - mod) / 26);
        }
    }
    catch (Exception Ex)
    {
        logger.Error("Error ", Ex);
    }

    return "=AND(FIND(\"@\"," + colLetter + "2),FIND(\".\"," + colLetter + "2),ISERROR(FIND(\" \"," + colLetter + "2)))";

}