Hi NJ,
Thank you for using Aspose products.
It would be of great help in understanding your exact requirements if you can share your sample spreadsheet containing the PivotTable in question and your desired results that you may create using the MS Excel application on the same spreadsheet.
As far as we understood your requirement, you probably wish to select a item from Report Filter dropdown, and based on that selection, you wish to dynamically populate the PivotTable. You can achieve this by switching the PivotItem’s IsHidden property. If set to false, the item will be selected and vice versa. For elaboration purposes, please check the below provided code snippet.
C#
public static void setFilterOptionByString(PivotTable table, string filterName, string value)
{
PivotField field = table.PageFields[filterName];
field.IsMultipleItemSelectionAllowed = true;
PivotItemCollection collection = field.PivotItems;
bool all = false;
if(value.Equals("(All)"))
{
all = true;
}
for (int i = 0; i < collection.Count; i++)
{
PivotItem item = collection[i];
if (all)
{
item.IsHidden = false;
}
else
{
if (item.Name.Equals(value))
{
item.IsHidden = false;
}
else
{
item.IsHidden = true;
}
}
}
table.RefreshData();
table.CalculateData();
table.RefreshDataOnOpeningFile = true;
}
In case you find some difficulty or have ambiguities, please share the spreadsheets as requested at the start of this post.