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

Free Support Forum - aspose.com

Remove field removes entire pivot table

Hi,


We seem to be having an issue using the PivotTable.RemoveField() method.
When I run the code this.Worksheet.PivotTables[0].RemoveField(PivotFieldType.Data, “&=Results.Test”); before or after a refresh of the worksheet, the entire pivot table is removed and replaced with plain text and the field that I tried to remove is still there.

Please assist.

Thanks,
Mark.

Hi,

Please download the latest version: Aspose.Cells
for .NET v6.0.0.4


Once you download it, then use the following code to remove pivot fields.

C#<span style=“font-size: 10pt; font-family: “Microsoft YaHei”,“sans-serif”;”>


pivotTable.RemoveField(PivotFieldType.Row, “a”);

pivotTable.CalculateData();

In case, you could not resolve the issue, then provide me your sample input xls/xlsx file containing your pivot table and let me know the field you want to remove. We will investigate it and provide you a sample code.