Set ShowDetail
Refer to the following example code to see how to expand or collapse a PivotItem's detail in PivotTable using Document Solutions for Excel.