diff --git a/EPPlus/ExcelRangeBase.cs b/EPPlus/ExcelRangeBase.cs index 659e9a10f..c1d747ce7 100644 --- a/EPPlus/ExcelRangeBase.cs +++ b/EPPlus/ExcelRangeBase.cs @@ -2013,8 +2013,9 @@ public ExcelRangeBase LoadFromCollection(IEnumerable Collection, bool Prin /// Will create a table with this style. If set to TableStyles.None no table will be created /// Property flags to use /// The properties to output. Must be of type T + /// A delegate that formats the names of the headers /// The filled range - public ExcelRangeBase LoadFromCollection(IEnumerable Collection, bool PrintHeaders, TableStyles TableStyle, BindingFlags memberFlags, MemberInfo[] Members) + public ExcelRangeBase LoadFromCollection(IEnumerable Collection, bool PrintHeaders, TableStyles TableStyle, BindingFlags memberFlags, MemberInfo[] Members, Func Formatter = null) { var type = typeof(T); bool isSameType = true; @@ -2067,7 +2068,7 @@ public ExcelRangeBase LoadFromCollection(IEnumerable Collection, bool Prin } else { - header = t.Name.Replace('_', ' '); + header = (Formatter != null) ? Formatter(t.Name) : t.Name; } } //_worksheet.SetValueInner(row, col++, header);