'How to move pivot table slicer from one sheet to another
Using EPPLUS, I have created a pivot table in a worksheet called PIVOT, and I am trying to create a slicer that is linked to that pivot table in another worksheet; All I am able to achieve is creating the slicer for in the same page as the pivot table.
I have tried looking into the documentary, but I couldn't find anything in it that would allow me to do that.
Does anyone have some ideas on how to achieve that?
Here's a snippet of the code:
private void _Write_Pivot(OfficeOpenXml.Table.ExcelTable table) {
#_sheetdict is a dictionary of the sheets in the workbook
OfficeOpenXml.ExcelWorksheet curSheet = _sheetdict["PIVOT"];
#adding pivot table
OfficeOpenXml.Table.PivotTable.ExcelPivotTable ptable = curSheet.PivotTables.Add(curSheet.Cells["A3"], table, "PIVOT");
#adding fields
ptable.RowFields.Add(ptable.Fields["Attribute1"]);
ptable.ColumnFields.Add(ptable.Fields["Attribute2"]);
ptable.DataFields.Add(ptable.Fields["Attribute3"]);
ptable.PageFields.Add(ptable.Fields["Attribute4"]);
ptable.PageFields.Add(ptable.Fields["Attribute5"]);
#adding slicer
ptable.Fields["Attribute1"].AddSlicer();
ptable.Fields["Attribute2"].AddSlicer();
#move slicer to other sheet
OfficeOpenXml.ExcelWorksheet nextSheet = _sheetdict["nextSheet"];
#???
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
