Inställning av pivottabellalternativ För tomma celler Visa
Contents
[
Hide
]
Du kan ställa in olika pivottabellalternativ med hjälp av Aspose.Cells. Ett sådant alternativ är “För tomma celler Visa”. Genom att ställa in detta alternativ visas alla tomma celler i en pivottabell som en angiven sträng.
Inställning av pivottabellalternativ i Microsoft Excel
För att hitta och ställa in detta alternativ i Microsoft Excel:
- Välj en pivottabell och högerklicka.
- Välj Pivottabellalternativ.
- Välj fliken Layout & Format.
- Välj alternativet Visa en sträng för tomma celler och ange en sträng.
Konfigurera Pivot Table Option med Aspose.Cells
Aspose.Cells tillhandahåller egenskaperna PivotTable.DisplayNullString och PivotTable.NullString för att ange pivot-tabellalternativet “Visa en sträng för tomma celler”.
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"); |