What version of EPPlus are you using? I ask because I am surprised it does not
throw an error as it does with 4.1.0 which is currently the latest. Maybe an
older version is more forgiving.
But to answer you question, if you look at the signature of the final overload
of
LoadFromCollectionthat is eventually called you will see this:
public ExcelRangebase LoadFromCollection<T>(IEnumerable<T> Collection, bool PrintHeaders, TableStyles TableStyle, BindingFlags memberFlags, MemberInfo[] Members)
Notice that Epplus is only looking at
MemberInfosand not a
Fieldswhich
is what you object is using. If you change
Stockobject to this:
class Stock{ public string Nif { get; set; } public string Proveedor { get; set; } public string Coodigo { get; set; } public string descripcion { get; set; } public string Catalogo { get; set; } public string Estadistico { get; set; } public decimal StockOn { get; set; }}You should see results.



