protected IEnumerable <DynamicExcelColumn> GetExcelColumns <T>() where T : class { var columns = new List <DynamicExcelColumn>(); var dataTypeProperties = typeof(T).GetProperties(); dataTypeProperties.ToList().ForEach(x => { columns.Add(new DynamicExcelColumn { Name = CustomAttributeHelper.GetColumnName(x), Width = CustomAttributeHelper.GetColumnWidth(x), FontSize = CustomAttributeHelper.GetFontSize(x), HeaderBackgroundColor = CustomAttributeHelper.GetHeaderBackgroundColor(x), HeaderFontColor = CustomAttributeHelper.GetHeaderFont(x), Alignment = CustomAttributeHelper.GetColumnAlignment(x) }); }); return(columns); }