Layout der Pivot Tabelle ändern

So ändern Sie das Layout der Pivot-Tabelle in MS-Excel

Microsoft Excel ermöglicht es Ihnen, das Layout der Pivot-Tabelle mithilfe der Menübefehle PivotTable-Tools > Entwurf > Berichtslayout zu ändern. Sie können das Layout in drei Formen ändern

  • Im kompakten Formular anzeigen
  • Im Gliederungsformular anzeigen
  • Im tabellarischen Formular anzeigen

Wie man das Layout der Pivot-Tabelle mit Aspose.Cells for Node.js via C++ ändert

Die Aspose.Cells for Node.js via C++-Bibliothek bietet außerdem die Methoden PivotTable.showInCompactForm(), PivotTable.showInOutlineForm() und PivotTable.showInTabularForm(), um das Layout der Pivot-Tabelle in diesen drei Formen zu ändern.

Beispielcode

Der folgende Beispielcode zeigt zunächst die Pivot-Tabelle im kompakten Formular, dann zeigt sie die Pivot-Tabelle im Gliederungsformular und zuletzt zeigt sie die Pivot-Tabelle im tabellarischen Formular.

const AsposeCells = require("aspose.cells.node");
//For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET
//The path to the documents directory.
var dataDir = RunExamples.GetDataDir(".")
//Create workbook object from source excel file
var workbook = new AsposeCells.Workbook(dataDir + "pivotTable_sample.xlsx");
//Access first worksheet
var worksheet = workbook.getWorksheets().get(0);
//Access first pivot table
var pivotTable = worksheet.getPivotTables().get(0);
//1 - Show the pivot table in compact form
pivotTable.showInCompactForm();
//Refresh the pivot table
pivotTable.refreshData();
pivotTable.calculateData();
//Save the output
workbook.save(dataDir + "CompactForm_out.xlsx");
//2 - Show the pivot table in outline form
pivotTable.showInOutlineForm();
//Refresh the pivot table
pivotTable.refreshData();
pivotTable.calculateData();
//Save the output
workbook.save(dataDir + "OutlineForm_out.xlsx");
//3 - Show the pivot table in tabular form
pivotTable.showInTabularForm();
//Refresh the pivot table
pivotTable.refreshData();
pivotTable.calculateData();
//Save the output
workbook.save(dataDir + "TabularForm_out.xlsx");