private void FillPropertyValue(SheetRow rowModel, ImportColumnProperty columnProperty, ICell cell) { var cellValue = cell == null ? null : CellValueHelper.GetCellValue(cell); if (string.IsNullOrWhiteSpace(cellValue)) { if (columnProperty.IsRequired || (!columnProperty.PropertyInfo.IsNullable() && columnProperty.PropertyInfo.PropertyType != typeof(string))) { rowModel.SetError(columnProperty.PropertyInfo.Name, columnProperty.EmptyErrorMessage); } } else { if (columnProperty.HasRegex && !Regex.IsMatch(cellValue, columnProperty.RegexPattern, columnProperty.RegexOptions)) { rowModel.SetError(columnProperty.PropertyInfo.Name, columnProperty.RegexErrorMessage); return; } var targetType = columnProperty.PropertyInfo.IsNullable() ? columnProperty.PropertyInfo.PropertyType.GetGenericArguments()[0] : columnProperty.PropertyInfo.PropertyType; columnProperty.PropertyInfo.SetValue(rowModel, this.ConvertValueType(cellValue, targetType)); } }