Hello
LAst editon installed (8.7.1.0)
This doesn't work:
for (int i = 0; i <= _sheetActiva.PivotTables[0].Fields(Aspose.Cells.Pivot.PivotFieldType.Data).Count; i++){
_sheetActiva.PivotTables[0].DataFields[i].IsAutoSort = true;
_sheetActiva.PivotTables[0].DataFields[i].IsAscendSort = true;
_sheetActiva.PivotTables[0].DataFields[i].AutoSortField = -1;
}
Error:
{“Object reference not set to an instance of an object.”} in "IsAscendSort = true;"
No problem with RowFields:
Aspose.Cells.Pivot.PivotFieldCollection pivotFields = _sheetActiva.PivotTables[0].RowFields; //Accessing the row fields.
Aspose.Cells.Pivot.PivotField pivotField = pivotFields[0]; //Accessing the first row field in the row fields.
pivotField.IsAutoSort = true; //Setting the field auto sort.
pivotField.IsAscendSort = true; //Setting the field auto sort ascend.
pivotField.AutoSortField = -1;//Setting the field auto sort using the field itself.