设置数据透视表选项 对空单元格显示

在Microsoft Excel中设置数据透视表选项

要在Microsoft Excel中查找并设置此选项:

  1. 选择数据透视表,右键单击。
  2. 选择数据透视表选项
  3. 选择布局和格式选项卡。
  4. 选择对空单元格显示选项并指定字符串。

使用Aspose.Cells设置数据透视表选项

Aspose.Cells提供用于设置"对空单元格显示"数据透视表选项的PivotTable.DisplayNullStringPivotTable.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");

相关文章