AddExtraPivotFields

Hi Team,

I’m having difficulties getting Add Extra pivot field created with Aspose.Cells in .NET. I am using MS Excel 2007 version.

For example, running the code:

Aspose.Cells.Worksheet pivotTableSheet = obj.ExcelWorkBook.Worksheets["Pivot"];
pivotTableSheet.PivotTables.Clear();
Aspose.Cells.PivotTable pt = pivotTableSheet.PivotTables[pivotTableSheet.PivotTables.Add("Data!A1:" + obj.ExcelWorkBook.Worksheets["Data"].Cells[ds.Tables["Pivot"].Rows.Count, ds.Tables["Pivot"].Columns.Count - 1].Name, 0, 0, "PivotTable")];
int index = 1;
pt.RowFields.AddByBaseIndex(index++); // agent_name
pt.ColumnGrand = true;
pt.ColumnFields.AddByBaseIndex(2); // nomination_type_name
pt.DataFields.AddByBaseIndex(2); // nomination_type_name
pt.DataFields.AddByBaseIndex(10); // amount_advanced
pt.AutoFormatType = Aspose.Cells.PivotTableAutoFormatType.Table2;

The pivot table is created for this report automatically when the report is generated. I have attached Excel sheet image: Errorfile.jpg

I want the Excel Report like this: NeededExcel.jpg

What do I need to do to make the pivot table generated with the above Excel format?

Hi,

We appreciate if you could provide us your template Excel file (containing the pivot table(s)) and give us your sample code. We will check it soon.

Thank you.