How to read a values from the pivot table using aspose java?

I could create a pivot table but i couldn’t get the values from that pivot table. Actually i need to copy the values from the pivot table and paste it on some others sheet . Is it possible or not?

@Raj1995Java,

You can access a PivotTable from a WorkSheet then all fields and methods of PivotTable class can be accessed.

// Instantiating an Workbook object
Workbook workbook = new Workbook("PivotTable.xlsx");
// Obtaining the reference of the worksheet
Worksheet sheet = workbook.getWorksheets().get("PivotTable");
// Getting the pivottables collection in the sheet
PivotTableCollection pivotTables = sheet.getPivotTables();
// Accessing the instance of PivotTable
PivotTable pivotTable = pivotTables.get(1);

Hope this helps a bit.

@Raj1995Java,

Moreover, if you need cells values in the Pivot table report, well, you need to refresh and calculate PivotTable data in the worksheet before creating and copying range of values b/w the worksheets. See the lines of code for your reference:
e.g
Sample code:

......
            pivotTable.refreshData();
            pivotTable.calculateData();
            pivotTable.calculateRange(); 
           //....
           // Your code goes here.
           //.........