The format for sending data to a closedXML template is a bit confusing to me.
In the Flat tables docs there's a sample for a template with header info and data from a list for the report, but I don't see where the list is connected to the template.
I have a similar scenario - header info for the top, data in a list for the report.
I've tried defining an object with all the data in it:
public class AllocationExportData
{
public List<AllocationExportItem> AllocationList { get; set; }
public string Host_custname { get; set; }
public string Host_custaddr { get; set; }
}
and setting up the template using those variables
But only the top two values are being found
I figure I'm naming something wrong, or setting up the object wrong.
Anyone?


About
Host_city,Host_stateetc... you need to add equivalently named properties in yourAllocationExportDataclass.About the issues in the table "Credit Recipient Information":
The link between a table in the Excel template and a collection in code is indeed not explicitly described in the ClosedXML.Report Quick Start. Fortunalty the Flat Tables page of the official documentation gives the necessary explanations.
Basically: You need to create a named range in your Excel sheet. See naming cells and ranges in Excel
The name of that range must be the name of the property representing the collection you wish to display on this table. Its type must implement
IEnumerable(again see the Flat Tables page).In your case, you should name the range: AllocationList
Now you have to define what is the range you want to name. Since you want each element of your
AllocationListto be stacked vertically (i.e. each one on a specific line, not displayed on the same line, each one at the right of the preceding one), you want to create what the documentation call a "vertical table".The Flat Tables page states:
In your case, the range should include all the cells with the error "Unknown identifier [...]", plus a second empty row below.