User's Guide > About the User's Guide > Word and Excel Templates > Word Templates in CB 7.2 - 9.2 > How to Filter Exported Work Items in Word Export
How to Filter Exported Work Items in Word Export
Assume following scenario: you want that Resolved or Closed items should not appear in the Word export.
One solution is to use a Tracker View which contains only those items you want, but sometimes this is not practical.
Alternatively you can filter the exported items from the Word template. The attached template file contains a small script at the beginning (easy to find as it is red text) which filters out the Resolved and Closed items.
What is happening here that the red script is iterating through the ${items} collection. This is the collection which contains all Work items being exported. Then this script removes the Resolved/Closed items, so these won't appear in the result.
The script is:


## Don't render resolved or closed items, so filter them out

## the items collection

#set($itemIterator = ${items.iterator()})

#foreach ($item in $itemIterator)

#if ($item.isResolvedOrClosed())#set($dummy=${itemIterator.remove()}) #* removing resolved/closed items *# #end

#end

Was this helpful?