Create Excel from Dictionary Forked from https://github.com/mustaddon/ArrayToExcel Thanks to Leonid Salavatov
var list = new List<Dictionary<string, string>>();
foreach (var child in children.ToList())
{
var dic = new Dictionary<string, string>();
dic.Add("Name", child.Name);
child.Properties.ForEach(c => dic.Add(c.PropertyType.Name, (c.GetValue() == null ? "-" : c.GetValue().ToString())));
list.Add(dic);
}
var excel = list.ToExcel();
var list = new List<Dictionary<string, string>>();
var dictionary = new Dictionary<string, string>();
dictionary.Add("HeaderName", "Value");
list.Add(dictionary);
var excel = list.ToExcel();