Insert Pivot Table

Create Pivot Table

It is possible to use Aspose.Cells to add pivot tables to spreadsheets programmatically.

Pivot Table Object Model

Aspose.Cells provides a special set of classes in the Aspose.Cells.Pivot namespace that are used to create and control pivot tables. These classes are used to create and set PivotTable objects, the building blocks of a pivot table. The objects are:

Creating a Simple Pivot Table Using Aspose.Cells

  1. Add data to a worksheet using the Cell object’s PutValue method. This 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, which is encapsulated in the Worksheet object.
  3. Access the new PivotTable object from the PivotTables collection by passing the PivotTable index.
  4. Use any of the PivotTable objects (explained above) to manage the pivot table.

After executing the example code, a pivot table is added to the worksheet.

Advance topics