ClosedXML.Report icon indicating copy to clipboard operation
ClosedXML.Report copied to clipboard

Data format questions.

Open VBartilucci opened this issue 2 years ago • 5 comments

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'm trying to use data that I'm placing in a list - how should everything be formatted in an object?

I built an object like this

public class AllocationExportData { public List<AllocationExportItem> AllocationList { get; set; } public string Host_custname { get; set; } public string Host_custaddr { get; set; }

}

it finds the "host" values, but the ones in the list don't get find when I use item.(fieldname)

I'm either setting up something wrong, or caling the names wrong - which is it?

VBartilucci avatar Mar 16 '22 17:03 VBartilucci

Attach your template please

b0bi79 avatar Mar 17 '22 07:03 b0bi79

Attached. SolAlloc_AOBC.zip

Details on list structure:


     public List<AllocationExportItem> AllocationList { get; set; }

 public class AllocationExportItem
    {

        public string KY_ENROLL { get; set; }
        public string TX_CUSTOMER_NAME { get; set; }
        public string TX_UTILITY_ACCOUNT { get; set; }
        public string KY_UTILITY_NAME { get; set; }
        public string TX_SERVICE_LINE_1 { get; set; }
        public string TX_SERVICE_LINE_2 { get; set; }
        public string TX_SERVICE_CITY { get; set; }
        public string KY_SERVICE_STATE { get; set; }
        public string TX_SERVICE_ZIP { get; set; }
        public string ALLOCATION_PERCENT { get; set; }
        public string ALLOCATIONKWH { get; set; }
        public string ALLOCATION_SCALING_FACTOR { get; set; }
        public string ALLOCATED_PERCENT_IN_FARM { get; set; }
    }

VBartilucci avatar Mar 17 '22 14:03 VBartilucci

Progress! I missed the bit about naming a range for the table. I did that and I got data. new file attached. SolAlloc_AOBC.zip

However, the data is loading to the sheet across, and not down. So there's still something off, not sure what. newout

VBartilucci avatar Mar 17 '22 17:03 VBartilucci

I recommend you read the documentation Here describes how to properly build a template for flat tables.

Right now you need to expand the range of AllocationList to A17:J18

b0bi79 avatar Mar 18 '22 15:03 b0bi79

@VBartilucci do you need any more help or I can close the issue?

Pankraty avatar Jul 27 '23 21:07 Pankraty