ピボットテーブルオプションの設定 空白セルに表示する内容を設定する
Contents
[
Hide
]
Aspose.Cellsを使用してさまざまなピボットテーブルオプションを設定できます。そのようなオプションの1つは"空白のセルに表示する内容"です。このオプションを設定することで、ピボットテーブル内のすべての空白セルが指定された文字列として表示されます。
Microsoft Excelでのピボットテーブルオプションの設定
Microsoft Excelでこのオプションを見つけて設定するには:
- ピボットテーブルを選択し、右クリックします。
- ピボットテーブルオプションを選択します。
- レイアウトと書式タブを選択します。
- 空白のセルに表示する内容オプションを選択し、文字列を指定します。
Aspose.Cellsを使用したピボットテーブルオプションの設定
Aspose.Cellsは、「空白セルに表示する内容」ピボットテーブルオプションを設定するためのPivotTable.DisplayNullStringおよびPivotTable.NullStringプロパティを提供します。
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 | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | |
Workbook wb = new Workbook(dataDir + "input.xlsx"); | |
PivotTable pt = wb.Worksheets[0].PivotTables[0]; | |
// Indicating if or not display the empty cell value | |
pt.DisplayNullString = true; | |
// Indicating the null string | |
pt.NullString = "null"; | |
pt.CalculateData(); | |
pt.RefreshDataOnOpeningFile = false; | |
wb.Save(dataDir+ "output_out.xlsx"); |