Issues with pivot tables

hi, i have been experiencing a few problems when trying to manipulate an excel template with a pivot table.

  1. when i remove a column through worksheet.Cells.DeleteColumn(int) the pivot table’s data source range does not get updated to reflect the shifted columns.
  2. when i rename a worksheet which is related to a pivot table the source for PivotCharts do not update, however PivotTables do. in the result file you will notice that the table’s values reflect the first tab, but the bar chart shows the values left over from the template and will not update.
i have attached a code sample with template and result that should demonstrate both of these issues. i am using cells v7.1.1.0

thanks

Hi,

Please use the following lines to refresh data and let us know if it works fine


PivotTable pvt …

pvt.RefreshData();

pvt.CalculateData();



Please download and use the latest version: Aspose.Cells for .NET 7.1.1

Hi,

Please change your source code like this:

C#


foreach (PivotTable pt in sht.PivotTables)
{
string[] t = new string[] { “=data!A1:C5”, null };

pt.ChangeDataSource(t);

pt.RefreshDataOnOpeningFile = true;
}

foreach (Chart cht in sht.Charts)
{
cht.PivotSource = “tables!PivotTable1”;

cht.RefreshPivotData();
}


Also,we will refresh the pivotsource of chart when changing the worksheet’s name in the next aspose version.

Hi,

Please download and try this fix: Aspose.Cells for .NET v 7.1.1.1

We could refresh the pivotsource of chart when changing the worksheet’s name in the latest aspose version 7.1.1.1.

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


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