如何使用 PivotOptions 管理数据透视图

什么是数据透视图

Excel中的数据透视图是从数据透视表中创建的数据的图形表示。它允许用户通过以图表形式汇总和显示信息来动态可视化和分析数据。数据透视图是交互式的,可以轻松修改以显示数据的不同视角,因此是Excel中数据分析和演示的强大工具。

如何使用数据透视表选项管理数据透视图

通过使用Aspose.Cells,您可以使用Aspose.Cells.Charts.PivotOptions来管理数据透视图。

样本文件和代码: 样本文件

//How to manage PivotChart with PivotOptions
path = "";
Workbook book = new Workbook(path + "Sample.xlsx");
Chart chart = book.Worksheets[0].Charts[0];
PivotOptions opt = chart.PivotOptions;
//Hide ZoneFilter in PivotChart
opt.DropZoneFilter = false; //HideZoneFilter
//You can set more properties, try them!
//opt.DropZoneCategories = false; //HideZoneCategories
//opt.DropZoneData = false; //HideZoneData
//opt.DropZoneSeries = false; //HideZoneSeries
//opt.DropZonesVisible = false; //Hide All
//Save the file and see the effect.
book.Save(path + "HideZoneFilter.xlsx");
view raw PivotOptions.cs hosted with ❤ by GitHub

通过上面的示例代码,您可以查看以下效果的结果文件,如下图所示:

输出