I'm creating an Excel file using the EPPlus library and C#.
In this Excel file there is a sheet with pivot table to which I'd like to add a filter field like in this manually created Excel sheet (Country):
How can I do this using EPPlus?
I'm creating an Excel file using the EPPlus library and C#.
In this Excel file there is a sheet with pivot table to which I'd like to add a filter field like in this manually created Excel sheet (Country):
How can I do this using EPPlus?
I did not see your code, but you can do something like this.
var ws = excelPackage.Workbook.Worksheets["index of your worksheet"];
var pivotTable = ws.PivotTables[0]; //assuming that you only have 1
var pivotField = pivotTable.Fields["Country"];
pivotTable.PageFields.Add(pivotField); // should add field into desired place
Hope it´s a little bit helpful. Don´t forget to save your excel file at the end.