You need to set the fillDownLabels to true. This is per the OpenXML specification for the PivotField element which the fillDownLabels is an attribute of.
To set it to true, use the following convention:
pField.SetAttribute("fillDownLabels", "true");
Also note from the spec that this attribute can be ignored in some situations:
This attribute is ignored when the compact attribute and the outline attribute of the PivotTable ([ISO/IEC-29500-1] section 18.10) field (1) are "true". This attribute is ignored if the PivotTable ([ISO/IEC-29500-1] section 18.10) field (1) is not on the PivotTable ([ISO/IEC-29500-1] section 18.10) row (2) axis or the PivotTable ([ISO/IEC-29500-1] section 18.10) column (2) axis.
To summarize - to get your fillDownLabels to work correctly:
- set the
fillDownLabels to true - the default is false
- make sure the
compact attribute of the outline attribute of this pField is set or false (likely the default - check the spec). If this is true, the fillDownLabels attribute is ignored.
- Ensure the Pfield is on the row axis or column axis, otherwise
fillDownLabels is ignored.
one last note for folks using OpenXMLSDK - to set a BooleanValue attribute you can use the convention:
fillDownLabels = BooleanValue.FromBoolean(true)