We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Error when refreshing pivot table with a grouped column


We have found this issue where we cannot refresh a pivot table containing a grouped date column when the data source table is empty. We get an “Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index” error during the PivotTable.RefreshData() method call when the source table is empty. Is it possible to refresh the pivot table’s cache in this scenario without getting this error?

I have attached a small project to demonstrate the issue. I have also attached an input file “input file with grouped date.xlsx” containing a pivot table where it’s date column is grouped. The code simply opens the input file, clear all it’s ListObjects, refreshes the pivot table, before finally saving the file as “generated file.xlsx”.

I have attached a screen shot “Error when refreshing pivot table with grouping.png” of the error message that appears when debugging during the “PivotTable.RefreshData” method call.


Thanks for the sample project with template file and screen shot.

After an initial test, I observed the issue as you mentioned by running your sample project with your template file. I found the error:
“Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index” as you pointed out by a screen shot. I have logged a ticket with an id “CELLSNET-41925” for your issue. We will look into it soon.

Once we have any update on it, we will let you know here.

Thank you.


We have fixed the issue.

Please download and try this fix: Aspose.Cells for .NET v7.5.2.1 and let us know your feedback.


Thank you for providing a fix for this issue. We have downloaded the latest version of Aspose.Cells and we no longer get the error message.

I was wondering it is possible to retain the grouping settings even after the source table is cleared (have no more data)?


Thanks for your feedback.

Good to know that you no longer get the error by the new fix.

Could you give us more details about your requirements or issue (regarding grouping settings etc.). You may also provide us your expected file here that you may create in MS Excel manually, also give us your output file by Aspose.Cells and attach some screen shots to highlight the difference. We will check your issue soon.

Thank you.

The issues you have found earlier (filed as CELLSNET-41925) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.