PivotTable DataFields Display Name

Hello,

I have a template file with existing Pivot Table with visible values captions.

I loaded the file, I refreshed the pivot table and i saved it into a new file, I lost my values captions.

Which option to use to set Values Caption visible. Can we apply the option by Value ?

Thanks,
Oussama

I found it, its the property ShowRowHeaderCaption.

But I did not found how to hide Field caption. I don’t want to see “values”. to do this I set display name to empty string like this : pivotTable.DataField.DisplayName = String.Empty; Is there an option to hide it without setting the displayName ?

@Oussama_Mokni,

See the following sample code segment on how to hide/visible certain items for your reference:
e.g
Sample code:

........
PivotItemCollection pItems = pivotField.PivotItems;
            for (int i = 0; i < pItems.Count; i++)
            {

                if (pItems[i].Name == "C" || pItems[i].Name == "D")
                {
                    pItems[i].IsHidden = false;
                }
                else
                {
                    pItems[i].IsHidden = true;
                }
            }

Hope, this helps a bit.

Hello,

It didn’t worked for me so I set the datafield display name to empty : “pivotTable.DataField.DisplayName = string.Empty”.

Thanks.

@Oussama_Mokni,

I think you may use your approach if it works for your needs. In case, you find any issue, kindly do share your sample code (runnable) and template file(s) to reproduce the issue, we will check it soon.