Turn off grand total and subtotal for pivot table using C#.NET

Hi,
I am using Aspose.cells for creating a pivot table. Is there a way to turn off grand total and subtotals for a pivot table. I can achieve the behavior using excel but I cannot find a code for it in aspose

I want to implement this using aspose.Please help

@an1,

Thanks for your query.

You may please give a try to the following sample code and provide your feedback. If it does not fulfill your requirement, provide us a runnable console application, a source template file, program output file and an expected output file created by Excel. Also explain the requirement using some images for clarification. We will analyze the information and provide our feedback.

 Workbook book = new Workbook("Example.xlsx");
PivotTable table = book.Worksheets["Pivot Table"].PivotTables[0];
table.RowGrand = false; //Set true if you wish to show the grand row total
table.ColumnGrand = false; //Set true if you wish to show the grand column total
for (int i = 0; i < table.RowFields.Count; i++)
{
    table.RowFields[i].SetSubtotals(PivotFieldSubtotalType.None, true);
}
book.Save("output.xlsx");