Create Pivot Tables and Pivot Charts

Add Pivot Tables and Charts Using Aspose.Cells for Node.js via C++

Aspose.Cells for Node.js via C++ provides a special set of classes used to create pivot tables. These classes are used to create and set PivotTable objects, which act as a PivotTable object’s basic building blocks:

  • PivotField, a field in a pivot table report.
  • PivotFields, a collection of all the PivotField objects in a pivot table.
  • PivotTable, a PivotTable report on a worksheet.
  • PivotTables, a collection of all the PivotTable objects on the worksheet.

Prepare to use Aspose.Cells for Node.js via C++

  1. Install Aspose.Cells for Node.js via C++ from NPM, use command as: $ npm install aspose.cells.node.
  2. You can also follow the step-by-step instructions on how to install “Aspose.Cells for Node.js via C++” to your developer environment.

How to Add a Pivot Table Using Aspose.Cells for Node.js via C++

To create a pivot table using Aspose.Cells for Node.js via C++:

  1. Add some data to a worksheet cells using a Cell object’s put_value method. You also use a template file already filled with data. The data will be used as the pivot table’s data source.
  2. Add a pivot table to the worksheet by calling the PivotTables collection’s add method (encapsulated in the Worksheet object).
  3. Access the new PivotTable object from the PivotTables collection by passing its index. # Use any of the pivot table objects encapsulated in the PivotTable object to manage the table.

Code examples are given below.

How to Add a Pivot Chart Using Aspose.Cells for Node.js via C++ Library

To create a PivotChart using Aspose.Cells for Node.js via C++:

  1. Add a chart.
  2. Set the PivotSource of the chart to refer to an existing pivot table in the spreadsheet.
  3. Set other attributes.