设置数据透视表选项 对空单元格显示
Contents
[
Hide
]
您可以使用Aspose.Cells for Python via .NET设置不同的数据透视表选项。其中一个选项是"对空单元格显示"。设置此选项,数据透视表中的所有空单元格都将显示为指定的字符串。
如何在Microsoft Excel中设置数据透视表选项
要在Microsoft Excel中查找并设置此选项:
- 选择数据透视表,右键单击。
- 选择数据透视表选项。
- 选择布局和格式选项卡。
- 选择对空单元格显示选项并指定字符串。
如何使用Aspose.Cells for Python Excel库设置数据透视表选项
Aspose.Cells for Python via .NET提供了设置"对空单元格显示"数据透视表选项的PivotTable.display_null_string和PivotTable.null_string属性。
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 | |
# The path to the documents directory. | |
dataDir = RunExamples.GetDataDir(".") | |
wb = Workbook(dataDir + "input.xlsx") | |
pt = wb.worksheets[0].pivot_tables[0] | |
# Indicating if or not display the empty cell value | |
pt.display_null_string = True | |
# Indicating the null string | |
pt.null_string = "null" | |
pt.calculate_data() | |
pt.refresh_data_on_opening_file = False | |
wb.save(dataDir + "output_out.xlsx") |