We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Set visibility of pivot field items


We are using Syncfusion XlsIO for reporting purposes.

I am working on a report which is based on a template.
The template contains a pivot table.
Using Syncfusion XlsIO I fill the datasource of the pivot table with new data.
The pivot table requires a filter on the column values. The filter is on a date field and is dynamic (the user specifies it upon report creation).

I cannot find out how to achieve this using XlsIO.

Let's sat the date column contains the following values:

And I need "1-5-2016" and "1-11-2016" as the column values.

I can access the Items collection of the pivot table field and set the visibility like so:

IPivotTable pivtable = this.Sheet.PivotTables["PivotTable6"];

IPivotField pivfield = pivtable.Fields["Date"];

pivfield.Items[0].Visible = false;

pivfield.Items[1].Visible = true;


however I cannot access the Text property of the PivotFieldItem because the IPivotTableFIeld interface only exposes the Visible property and I cannot cast to PivotFieldItem because the class is not exposed.

So how do I determine dynamically which items I need to set to visible?

I would need access to the Text property so I can determine if I need to set Visible to true or false.

Any help would be appreciated,



1 Reply

AV Abirami Varadharajan Syncfusion Team March 15, 2017 01:54 PM UTC

Hi Peter, 
Thank you for contacting Syncfusion support.

We have planned to expose the Text property in IPivotFieldItem, which will be available in our upcoming main release 2017 Vol 2.
Meanwhile, we have prepared a woraround to get the Text property value of PivotFieldItem using reflection and the sample can be downloaded from the following link. 
Kindly refer and let us know if your requirement is fulfilled. 

Live Chat Icon For mobile
Up arrow icon