2

I found horizontal table example here: https://closedxml.github.io/ClosedXML.Report/docs/en/Flat-tables.html

But data was arranged in a way that every entry on a list was a row and each row had array and that array was this dynamic length horizontal element. The problem is that my data structure is a little bit different, essentialy its list of columns. Its list of objects that have header and list of objects that are column data. Im not sure how to make template so it will iterate horizontally through entities and then for each of them vertically through subentities.

Thats the main problem. Additionaly there is still another issue. Sub entities consists of name and quantity. Every parent entity has the same list of names in subentity, just diffrent quantities.

To visualize it, lets say i have list of orders where every order is separate column and they consists of the same items just with diffrent quantities.

Order structure:

class Order
  {
     public string OrderNumber{ get; set; }
     public IEnumerable<ProductWithQuantity> ProductsWithQuantities{ get; set; }
  }

class ProductWithQuantity
  {
     public string ProductName{ get; set; }
     public int Quantity{ get; set; }
  }

I want to pass IEnumerable<Order> and using template generate excel like this:

enter image description here

kkamil4sz
  • 431
  • 1
  • 5
  • 19

0 Answers0