//Adding a PivotTable to the worksheet
int index = pivotTables.add("=A1:C8","E3","PivotTable1");
//Accessing the instance of the newly added PivotTable
PivotTable pivotTable = pivotTables.get(index);
//Unshowing grand totals for rows.
pivotTable.setRowGrand(false);
//Dragging the first field to the row area.
pivotTable.addFieldToArea(PivotFieldType.ROW,0);
//Dragging the second field to the column area.
pivotTable.addFieldToArea(PivotFieldType.COLUMN,1);
//Dragging the third field to the data area.
pivotTable.addFieldToArea(PivotFieldType.DATA,2);
//Saving the Excel file
workbook.save("data/AsposePivotTable.xls");
// Print Message