Extension for the EPPlus library to create reports from complex objects
Given a list like this:
var complexObject = new List<RootLevel> {
new RootLevel {
SimpleProperty = "String1",
ComplexProperty = new SecondLevel
{
LeftColumn = "Left side 1",
RightColumn = new ThirdLevel
{
CatA = 11,
CatB = 12,
CatC = 13
}
}
},
new RootLevel {
SimpleProperty = "String2",
ComplexProperty = new SecondLevel
{
LeftColumn = "Left side 2",
RightColumn = new ThirdLevel
{
CatA = 21,
CatB = 22,
CatC = 23
}
}
}
};
this code:
using var xls = new ExcelPackage();
var report = new MultiHeaderReport<RootLevel>(xls, "Object");
report.GenerateReport(complexObject);
xls.SaveAs("Report.xlsx");
will render like this: