private Type GetDynamicType(ISheet sheet) { var firstRowIndex = GetFirstRowIndex(sheet); var firstRow = sheet.GetRow(firstRowIndex); var names = new Dictionary <string, Type>(); foreach (var header in firstRow) { var column = GetColumnInfoByDynamicAttribute(header); var type = Helper.InferColumnDataType(sheet, HasHeader ? firstRowIndex : -1, header.ColumnIndex); if (column != null) { names[column.Attribute.PropertyName] = type ?? typeof(string); } else { var headerValue = GetHeaderValue(header); var tempColumn = new ColumnInfo(headerValue, header.ColumnIndex, null); if (_columnFilter != null && !_columnFilter(tempColumn)) { continue; } string propertyName; if (HasHeader && MapHelper.GetCellType(header) == CellType.String) { propertyName = MapHelper.GetVariableName(header.StringCellValue, IgnoredNameChars, TruncateNameFrom, header.ColumnIndex); } else { propertyName = MapHelper.GetVariableName(null, null, null, header.ColumnIndex); } names[propertyName] = type ?? typeof(string); DynamicAttributes[propertyName] = new ColumnAttribute((ushort)header.ColumnIndex) { PropertyName = propertyName }; } } return(AnonymousTypeFactory.CreateType(names, true)); }