Show Report Filter Pages option

Show report filter pages option

Excel supports creating pivot tables, adding report filters and enable the “Show Report Filter Pages” option. Aspose.Cells also supports this feature to enable the “Show Report Filter Pages” option on the created pivot table. The following is the screen showing the option in Excel.

todo:image_alt_text

As a result of this option, the created workbook contains more worksheets. It splits every possible value of the report filter in a separate worksheet. In this example, it has a filter on “Position” and data have three distinct positions (A, B, C). This feature adds 3 additional worksheets named A, B, C which are the same pivot table but with preselected option A, B, and C.

The sample file and output file can be downloaded from the following links:

samplePivotTable.xlsx

outputSamplePivotTable.xls

Source Code

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
// Load template file
Workbook wb = new Workbook(srcDir + "samplePivotTable.xlsx");
// Get first pivot table in the worksheet
PivotTable pt = wb.getWorksheets().get(1).getPivotTables().get(0);
// Set pivot field
pt.showReportFilterPage(pt.getPageFields().get(0));
// Set position index for showing report filter pages
pt.showReportFilterPageByIndex(pt.getPageFields().get(0).getPosition());
// Set the page field name
pt.showReportFilterPageByName(pt.getPageFields().get(0).getName());
// Save the output file
wb.save(outDir + "outputSamplePivotTable.xlsx");