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.
Unfortunately, activation email could not send to your email. Please try again.

Set visibility of pivot field items

Thread ID:





129343 Mar 14,2017 01:47 AM Mar 15,2017 09:54 AM ASP.NET MVC 1
Tags: XlsIO
Peter meulendijks
Asked On March 14, 2017 01:47 AM


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,



Abirami Varadharajan [Syncfusion]
Replied On March 15, 2017 09:54 AM

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. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.