Cambiando el Diseño de la Tabla Dinámica

Cómo cambiar el diseño de la tabla dinámica en MS-Excel

Microsoft Excel te permite cambiar el diseño de la Tabla Dinámica utilizando los comandos del menú Herramientas de tabla dinámica > Diseño > Diseño de informe. Puedes cambiar el diseño en estas tres formas

  • Mostrar en Forma Compacta
  • Mostrar en Forma de Esquema
  • Mostrar en forma tabular

Cómo cambiar el diseño de la tabla dinámica usando Aspose.Cells for Node.js via C++

La biblioteca Aspose.Cells for Node.js via C++ también proporciona los métodos PivotTable.showInCompactForm(), PivotTable.showInOutlineForm() y PivotTable.showInTabularForm() para cambiar el diseño de la tabla dinámica en estas tres formas.

Código de muestra

El siguiente código de ejemplo muestra primero la Tabla Dinámica en Forma compacta, luego la muestra en Forma de esquema y por último muestra la Tabla Dinámica en Forma tabular.

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