0

enter image description here

Here Gross Margin is parent.
Below rows are child so i want to have drill down at parent level i.e at Gross margin

Is there any way to do this using closedxml excel or do i need to use something else?

Just code
  • 13,553
  • 10
  • 51
  • 93
S2K
  • 1,185
  • 3
  • 27
  • 55
  • If you mean the outline / grouping feature, see [this answer](http://stackoverflow.com/a/25783647/2610249) for how to do it with ClosedXML. – Raidri Feb 05 '16 at 09:54
  • i mean expanding and collapsing of parent row. – S2K Feb 05 '16 at 09:56
  • ohk Sir !!!! Here Gross Margin is the parent (see above image) and the rows below that are its child segments. So when i do export to excel, be default + sign should come at Gross Margin, when i will click on Gross margin then it should display child segment. – S2K Feb 05 '16 at 10:17
  • @Raidri Yes Thank You!!! But how would i make rows collapsed by default i have used " ws.Rows(4, 5).Group(); ws.CollapseRows(2); not working – S2K Feb 05 '16 at 10:50

1 Answers1

1

Use something like this:

var ws = wb.Worksheet(1);
ws.Rows(firstChildRowNumber, lastChildRowNumber).Group();
ws.CollapseRows(1); // collapse to level 1
Raidri
  • 17,258
  • 9
  • 62
  • 65