Reputation: 53
I am working on a project and I’m using ClosedXML to document some results in an Excel sheet.
I have the following data structure:
The PortTag Dictionary is just a Key Value Pair of Port Id and Tag (either “T”, “U”, “F” or “-“) This should result in a Table that looks like this:
This is the combination of a vertical and a horizontal version and I’m failing to create it.
My current sheet displays information I polled off of a switch with SNMP and looks as follows:
Is there any help you can offer me or direct me to a source of knowledge regarding this problem?
I already read the information on the Github Wiki and the Website (https://closedxml.github.io/ClosedXML.Report/docs/en/)
thank you very much !
Upvotes: 1
Views: 1904
Reputation: 591
Vlan
entries have the same set of keysYou can use this approach:
Vlans
PortTag_Values
insidePortTagKeys
where the keys should be placeddata
as one variable and PortTagKeys
as another (note that I ommit checks for null and empty collection for simplicity):var template = new XLTemplate(workbook);
template.AddVariable(data);
template.AddVariable("PortTagKeys", data.Vlans[0].PortTag.Keys);
template.Generate();
Vlan
entries may have different sets of keysIn this case, I would suggest performing a pre-processing to get a collection of all keys and to fill all PortTag
s with the same keys (putting -
for missing keys). I doubt it is possible to do in "pure" ClosedXML.Report, without pre-processing.
Upvotes: 2