ピボットテーブルオプションの設定 空白セルに表示する内容を設定する

Microsoft Excelでのピボットテーブルオプションの設定

Microsoft Excelでこのオプションを見つけて設定するには:

  1. ピボットテーブルを選択し、右クリックします。
  2. ピボットテーブルオプションを選択します。
  3. レイアウトと書式タブを選択します。
  4. 空白のセルに表示する内容オプションを選択し、文字列を指定します。

Aspose.Cellsを使用したピボットテーブルオプションの設定

Aspose.Cellsは、「空白セルに表示する内容」ピボットテーブルオプションを設定するためのPivotTable.DisplayNullStringおよびPivotTable.NullStringプロパティを提供します。

// 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");

関連記事