This project has moved and is read-only. For the latest updates, please go here.

How to change selected items in page fields in a pivot table?

Dec 11, 2013 at 10:59 PM
Edited Dec 11, 2013 at 11:00 PM
I'm trying to change this value from 0 to 1:


I would expect to do something like this:
pivotTable.PageFields[3].Items[0].checked = false;
pivotTable.PageFields[3].Items[1].checked = true;

But I can't see any way to chose which items are selected.
Dec 12, 2013 at 3:05 PM
I figured out how to do it with excel interop in case this helps anybody:
            Application excelApp = new Application();
            Workbook workBook = excelApp.Workbooks.Open(filePath);

            foreach (Worksheet sheet in workBook.Sheets)
                foreach (PivotTable pivotTable in sheet.PivotTables())
                    pivotTable.PivotCache().MissingItemsLimit = XlPivotTableMissingItems.xlMissingItemsNone;

                    PivotField Value = (PivotField)pivotTable.PageFields("Value");

                    PivotItem one = (PivotItem)Value.PivotItems("1");
                    one .Visible = true;

                    PivotItem zero= (PivotItem)Value.PivotItems("0");
                    zero.Visible = false;

If anybody knows how to do this in EPPlus that would be awesome. It would be nice if interop wasn't necessary.