Hi,
I want to format my pivot table in the classic pivot layout like in Excel (PivotTable Options -> Display -> Classic PivotTable-Layout)
Can everybody help me. Currently I use the follwing code, but it doesn’t work:
//Adding a new sheet
Worksheet pivotSheet = workbook.Worksheets[workbook.Worksheets.Add()];
//Naming the sheet
pivotSheet.Name = “PivotTable”;
//Getting the pivottables collection in the sheet
Aspose.Cells.Pivot.PivotTableCollection pivotTables = pivotSheet.PivotTables;
//Adding a PivotTable to the worksheet
int index = pivotTables.Add("=Data!A1:" + CellsHelper.CellIndexToName(rowCount, columnCount), “B2”, tableName);
//Accessing the instance of the newly added PivotTable
Aspose.Cells.Pivot.PivotTable pivotTable = pivotTables[index];
//Showing the grand totals
pivotTable.RowGrand = true;
pivotTable.ColumnGrand = true;
//Setting the PivotTable report is automatically formatted
pivotTable.IsAutoFormat = true;
//Setting the PivotTable autoformat type.
pivotTable.AutoFormatType = Aspose.Cells.Pivot.PivotTableAutoFormatType.Classic;
pivotTable.ShowInCompactForm();
P.S.: I use the Aspose Cells Version 8.7.0.0
Thanks in advance.
Benjamin