显示报表筛选页选项
Contents
[
Hide
]
显示报表筛选页选项
Excel支持创建数据透视表、添加报表筛选器并启用“显示报表筛选器页面”选项。Aspose.Cells也支持此功能,可在创建的数据透视表上启用“显示报表筛选器页面”选项。以下是在Excel中显示“显示报表筛选器页面”选项的截图。
可从此处下载示例源文件和输出文件以测试示例代码:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// Load template file | |
Workbook wb = new Workbook(sourceDir + "samplePivotTable.xlsx"); | |
// Get first pivot table in the worksheet | |
PivotTable pt = wb.Worksheets[1].PivotTables[0]; | |
// Set pivot field | |
pt.ShowReportFilterPage(pt.PageFields[0]); | |
// Set position index for showing report filter pages | |
pt.ShowReportFilterPageByIndex(pt.PageFields[0].Position); | |
// Set the page field name | |
pt.ShowReportFilterPageByName(pt.PageFields[0].Name); | |
// Save the output file | |
wb.Save(outputDir + "outputSamplePivotTable.xlsx"); |