Hi Support,
In the PivotTable, the totals of values that use a calculated fields are missing after the execution of:
wb.Worksheets[i].PivotTables[k].RefreshData();
wb.Worksheets[i].PivotTables[k].CalculateData();
I have attached an example to replicate the issue: you can see that the total of the “%var” values (Field1 calculate field) are missing.
OP-6016.zip (99.5 KB)
@andreagasparin,
Thanks for providing us sample project with template file.
After an initial test, I am able to reproduce the issue as you mentioned by using your sample code with your template file. I found that Total values are missing for the calculated fields at the bottom when refreshing/calculating PivotTable data. The last row (for “Total var%”) is wrong in the PivotTable which should be calculated as:
Total var% -0.407482358 2.076980233 -0.076812328
e.g
Sample code:
Workbook wb = new Workbook("E:\\test2\\OP-6016\\OP-6016\\OP-6061.xlsx");
for (int i = 0; i < wb.Worksheets.Count; i++)
{
for (int k = 0; k < wb.Worksheets[i].PivotTables.Count; k++)
{
wb.Worksheets[i].PivotTables[k].RefreshData();
wb.Worksheets[i].PivotTables[k].CalculateData();
wb.Worksheets[i].PivotTables[k].CalculateRange();
}
}
wb.Save("E:\\test2\\OP-6016\\OP-6016\\out1.xlsx", SaveFormat.Xlsx);
wb.Save("E:\\test2\\OP-6016\\OP-6016\\out2.pdf", SaveFormat.Pdf);
I have logged a ticket with an id “CELLSNET-45671” for your issue. We will look into it soon.
Once we have an update on it, we will let you know here.
@andreagasparin,
This is to inform you that we have fixed your issue (logged earlier as “CELLSNET-45671”) now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.
@andreagasparin
Thanks for using Aspose APIs.
Please download and try the following fix and let us know your feedback.
The issues you have found earlier (filed as CELLSNET-45671) have been fixed in this Aspose.Cells for .NET 17.11 update.
Please also check the following article: