To add filters to each column headers in the pivot sheet in the excel automatically via c# code using Spire.Xls package.
PivotField r1 = pt.PivotFields["Invoice Type"] as PivotField;
r1.Axis = AxisTypes.Row;
r1.RepeatItemLabels = true;
r1.Subtotals = SubtotalTypes.None;
pt.Options.RowHeaderCaption = "Invoice Type";
here i have created a pivot field which gets added in Rows in pivot table getting displayed in the pivot sheet as column headers and I need filters for the same
PivotField r1 = pt.PivotFields["Invoice Type"] as PivotField;
r1.Axis = AxisTypes.Row;
r1.RepeatItemLabels = true;
r1.Subtotals = SubtotalTypes.None;
pt.Options.RowHeaderCaption = "Invoice Type";
foreach (var field in pt.RowFields)
{
PivotReportFilter filter = new PivotReportFilter(field.Name, true);
pt.ReportFilters.Add(filter);
}
field.Name – doenot have a definition for Name