User Guide > About the User Guide > Word and Excel Templates > Excel Templates > Exporting Hierarchy of Work Items to Excel using Custom Templates
Exporting Hierarchy of Work Items to Excel using Custom Templates
If you want to perform an Excel export from items that are parents or children of each other, form a hierarchy.
For example,
Then you want to get this result:
This template contains all necessary code:excelWithHierarchy.xlsx
The script pieces from this template:
The call to the ExcelHierarchyCellDecorator will add the necessary Excel indentation to the cell being exported:


<cb:groovy template="false" silent="false">

com.intland.codebeamer.text.excel.ExcelHierarchyCellDecorator.indentCell(cell, hierarchyProvider, item);



return item.name;

</cb:groovy>

The call in the C column: ${hierarchyProvider.getLevel(item)} returns the item's level/depth in the parent-child hierarchy.
The call in the D column: ${hierarchyProvider.getPath(item)} will print out the item's path in this hierarchy like 1.3.5.
Was this helpful?