Pivot table throw exception while refreshing

Hi,

We are using the following code to refresh pivot table in the following 2 files, but it throws exception :

[Object reference not set to an instance of an object.] Stack trace below:

at ?.?.?(String ?, Worksheet ?)

at ?.?.?()

The pivot table is "PivotTable1" in worksheet "Customres". It is created using Aspose. The code we are using to refresh pivot table is :

pivotTable.RefreshData();

pivotTable.CalculateData();

Could you please take a look at both workbooks and let us know where the issue is ASAP please? If you need more information regarding this issue, please dont hesitate to let us know.

Regards

Bill

Hi,

After an initial test, I can find the issue (i.e.., got exception:"NullReferenceException was unhandled") using the following sample code with your template file.

Sample code:
Workbook workBook = new Workbook("e:\\test2\\Working+Customer+Report.xls");

Aspose.Cells.Worksheet worksheet = workBook.Worksheets["Customers"];
MessageBox.Show(worksheet.PivotTables.Count.ToString());

foreach (Aspose.Cells.Pivot.PivotTable pivotTable in worksheet.PivotTables)
{
pivotTable.RefreshData();
pivotTable.CalculateData(); //Error Occured

}
//save workbook...
workBook.Save("e:\\test2\\outWorking+Customer+Report.xls");

I have logged a ticket with an id: CELLSNET-40117. We will look into it soon.

Thank you.

Hi,


Please try our latest version/fix: v7.0.3.2, your issue is fixed.

Thank you

Hi,

This issue is confirmed to be resolved. Thank you for your great support.

Regards

Bill

Hi Amjad,

We have got another issue refresh a pivot tables in another workbook.

It throws an exception when we refresh the pivot tables in the attached workbook twice(first refresh ok, but second failed).

The exception message:

Msg [Index was outside the bounds of the array.] Stack trace below:

at .?.(ArrayList C8Records, Boolean ignore, PivotField dataField, Boolean[] flags, ConsolidationFunction function, cache, Int32 number,  item, Int32& count)


at .?.(PivotItem , PivotItem , ArrayList , Boolean , PivotField , Int32 ,  )


at .?.(Int32 , Int32 ,  , ArrayList )


at .?.()


at .?.()

The code to test it should be the same as your previous post.

Hi,

Follow my previous post, there is a easy way to reproduce the problem:

Refresh the pivot table in worksheet "Bonus Amount" of workbook "SampleSalespersonReports (1).xls", you should be able to get the exception.

Thanks and regards

Bill

Hi,

I got IndexOutOfRangeException using your newly attached file with my sample code:

Sample code:
Workbook workBook = new Workbook("e:\\test2\\SampleSalespersonReports+(1).xls");

Aspose.Cells.Worksheet worksheet = workBook.Worksheets["Bonus Amount"];
MessageBox.Show(worksheet.PivotTables.Count.ToString()); //OK

foreach (Aspose.Cells.Pivot.PivotTable pivotTable in worksheet.PivotTables)
{
pivotTable.RefreshData();
pivotTable.CalculateData(); //Error

}

I have reopened your issue now. We will figure it out soon.

Thank you.

Hi Amjad,

Thanks for your reply! The issue you described is exactly the one I got.

Thanks and regards

Bill

Hi Amjad,

Thanks for the the great support on our pivot issues.

For this issue, could you give us a brief ETA so that we could make some arrangement at our end?

Thanks and regards

Bill

Hi,

Thanks for your posting. We will provide you ETA for this issue asap.

Hi,

We could fix this exception, but calculating grouping pivotfield is more complex, we will try our best to support it next month.

Hi,

Please… download: Aspose.Cells for .NET v7.0.4.4

We have fixed this issue.

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


This message was posted using Notification2Forum from Downloads module by aspose.notifier.