禁用数据透视表功能区
Contents
[
Hide
]
基于数据透视表的报告很有用,但是如果目标用户不了解如何配置这些报告,则容易出错。在这种情况下,组织将希望限制用户无法更改基于数据透视表的报告。通常不建议每个用户使用常见的数据透视表功能,如添加附加筛选器,切片器,字段或更改报告中某些内容的顺序。另一方面,这些用户还应能够刷新报告并使用现有的筛选器或切片器。Aspose.Cells for Python via .NET为开发人员提供了限制用户在创建这些报告时更改这些报告的能力。为此,Excel提供了一个功能来禁用数据透视表功能区,Aspose.Cells for Python via .NET也提供了相同的功能,即开发人员可以禁用包含用于修改这些报告的控件的功能区。
如何使用Aspose.Cells for Python Excel库禁用数据透视表功能区
以下代码通过访问工作表中的数据透视表,并将enable_wizard设置为false来演示此功能。示例数据透视表文件可以从此链接下载。
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
from aspose.cells import Workbook | |
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET | |
# Open the template file containing the pivot table | |
wb = Workbook("pivot_table_test.xlsx") | |
# Access the pivot table in the first sheet | |
pt = wb.worksheets[0].pivot_tables[0] | |
# Disable ribbon for this pivot table | |
pt.enable_wizard = False | |
# Save output file | |
wb.save("out.xlsx") |