Skip to end of metadata
Go to start of metadata
Contents Summary
 

Show report filter pages option

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

Show report pages filter option.png

As a result of this option the created workbook contains more worksheets. It splits every possible value of 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.

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

samplePivotTable.xlsx

outputSamplePivotTable.xlsx

 

 Sample Code
// 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");

 

Labels
  • No labels