Hi, I wanted to filter out a blank column on my pivot table. See attachment for my sample pivot table and chart. I don’t want the column J to be included in my pivot table and chart, since it is a blank column, is there a way to add filtering to the pivot table field type column?
out.zip (12.7 KB)
@rmacero,
Thanks for the sample file.
See and try the following sample code to accomplish your task for your reference. I added pivot filters to your existing pivot table in your provided file, applied filters as per your needs and re-saved the file for your requirements.
e.g.
Sample code:
Workbook workbook = new Workbook("e:\\test2\\out.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
PivotTable pivotTable = worksheet.PivotTables[0];
int index = pivotTable.PivotFilters.Add(0, PivotFilterType.CaptionEqual);
PivotFilter filter = pivotTable.PivotFilters[index];
filter.AutoFilter.Custom(0, FilterOperatorType.Equal, "?*");
workbook.Save("e:\\test2\\out1.xlsx");
Hope, this helps a bit.