aspose-free-consulting / projects

The starting point for Aspose free consulting projects
5 stars 5 forks source link

Seeking Aspose.Cells API on Excel Pivot Table Display Field List Option #433

Open larryfan2023 opened 1 month ago

larryfan2023 commented 1 month ago

Fields Filters I'm using Aspose.Cells to create Excel PivotTable. I want to set the Field List option to Sort A to Z in Display tab in PivotTable Options, see my attached screenshot. I searched documentation and post but couldn't find API that can be utilized for this purpose.

Could you please advise me if there's such capability in Aspose.Cells or I should seek for workaround?

Thanks.

amjad-sahi commented 4 weeks ago

@larryfan2023,

Thanks for the screenshot.

Please try to use the PivotField.IsAutoSort Boolean attribute and set it to "true" to perform the desired sorting for the pivot row field. e.g., Sample code:

// Access the Row field and set the sort order
PivotField rowField = pivotTable.RowFields[0];
rowField.IsAutoSort = true;
rowField.IsAscendSort = true;

Hope, this helps a bit.

We also recommend posting your queries in the dedicated forum.