How do you remove subtotals from a pivot using .NET, similar to the Java solution in the following post?
See the equivalent sample code in .NET for your reference:
Workbook book = new Workbook(dir + “Example.xlsx”);
PivotTable table = book.Worksheets[“Pivot Table”].PivotTables;
for (int i = 0; i < table.RowFields.Count; i++)
// table.RowFields[i].SetSubtotals(PivotFieldSubtotalType.None, true);
book.Save(dir + “output.xlsx”);
This code doesn’t have any effect. Please can you show a sample file and the output. I really need a solution to this urgently!
Could you provide us your input and output Excel file (after using the code segment), we will check it soon. Also give us your expected file which you could create/update in MS Excel manually.
Find attached some sample input and expected output. In all I simply want to show the top level row data. This can be done either by removing the subtotals or collapsing the hierarchical tree.
Thanks for the sample files.
Well, your underlying PivotTable’s data source in you template files is some external Excel file. Please note, the Aspose.Cells APIs currently do not support Pivot Table recalculations/manipulations in case the data source is external. However, if the data source resides in the same spreadsheet, you can manipulate or refresh the Pivot Tables accordingly.