//Get the first worksheet
Worksheet sheet =null;
for(int i=0;i<=workbook.getWorksheets().getCount();i++)
{
sheet = workbook.getWorksheets().get(i);
//Get the pivot tables in the sheet
PivotTableCollection pivotTables = sheet.getPivotTables();
//Get the first PivotTable
PivotTable pivotTable = pivotTables.get(i);
//Set the refresh data flag on
pivotTable.setRefreshDataFlag(false);
//Refresh and calculate the pivot table data
pivotTable.refreshData();
pivotTable.calculateData();
}
//Save the Excel file
workbook.save(templateFilePath);
and getting the error
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at com.aspose.cells.PivotTableCollection.get(Unknown Source)
at com.steelwedge.reportapplet.ReportApplet.mergeAndOpenTemplate(ReportApplet.java:162)
at com.steelwedge.reportapplet.ReportRunnable$1$1.run(ReportRunnable.java:137)