I am trying to output relational data in a spreadsheet by using smartmarkers.
// Sample Objects:
public class Parent
{
public long ParentId {get; set;}
public string Name {get; set;}
public IList Children {get; set;}
}
public class Child
{
public long ChildId {get; set;}
public string Name {get; set;}
}
// Sample Code:
IList parent = new List()
{
new Parent()
{
ParentId = 1,
Name = “George”,
Children = new List()
{
new Child() { ChildId = 1, Name = “Jimmy” },
new Child() { ChildId = 2, Name = “Susan” }
}
},
new Parent()
{
ParentId = 2,
Name = “Samantha”,
Children = new List()
{
new Child() { ChildId = 3, Name = “Jake” },
new Child() { ChildId = 4, Name = “Isaac” },
new Child() { ChildId = 5, Name = “Luke” }
}
}
};
WorkbookDesigner wd = new WorkbookDesigner();
wd.SetDataSource(“parent”, parent);
wd.Process();
// Sample SmartMarkers in Excel File:
…and then render that by applying SmartMarkers in a spreadsheet:
A | B | C | D | E |
1 |
Parent |
Children |
Age |
|
2 | &=parent.Name(noadd,skip:1) | &=parent.Age |
||
3 | &=parent.Children.Name | &=parent.Children.Age |
||
4 |
I've tried a couple variants of this, including group:normal, etc. but nothing seems to work the way I want it. What I would like it to look like is this:
A | B | C | D | E |
1 |
Parent |
Children |
Age |
|
2 |
George |
34 |
||
3 | Jimmy | 3 |
||
4 | Susan |
1 |
||
5 |
||||
6 |
Samantha |
45 |
||
7 |
Jake |
20 |
||
8 |
Isaac |
18 |
||
9 |
Luke |
7 |
Thanks for any advice!