Sorting row field by values in specific column field

We want to know how to do below manual sort through Aspose – sorting row field by values in specific column field (here instead of sorting row field by grand total values we want to sort by values in second column field)

image.png (5.6 KB)

Please Let me know if you need sample application

@LakshmiAys,

Please create a sample standalone console application with your sample file(s), zip the project and files and post us, we will check it soon. Also provide your expected sorted pivot data via a sample (manually created in MS Excel) file for reference.

Attaching the sample application.AsposeExcelColumnFieldSortIssue.zip (5.5 MB)

@LakshmiAys,

I tried your code using your project and also played upon with some other APIs but I could not accomplish your desired task (as per your screenshot). I found data sorting for row field is always/by default done by Grand Total column and not by Values in selected column or any other column. I have logged a ticket with an id “CELLSNET-47811” for your issue. We will look into it soon. We will check if your sample code needs some tweak or evaluate it to try to support it.

Once we have an update on it, we will let you know.

Thanks for the quick response. Will wait to hear from you on your further analysis and a possible work around for this issue.

@LakshmiAys,
Sure, we will write back here soon to share our feedback.

@LakshmiAys,

Please note, sorting PivotField by Values in selected column/row is not supported in Aspose.Cells APIs for now. We will support it later on.

Once we have an update on it, we will let you know.

@LakshmiAys,

We are pleased to inform you that your issue (Ticket ID: “CELLSNET-47811”) has been resolved. We have supported sorting PivotField by values in selected column/row. The fix/enhancement will be included in our upcoming release (Aspose.Cells v24.8), which we plan to release before the end of this week. You will be notified once the new version is published.

You may try the following sample code with the new version once it becomes available.
e.g.,

var book = new Workbook(stringFilePath);
Worksheet ws = book.Worksheets[1];
var pTable = ws.PivotTables[0];

pTable.RowFields[0].SortBy(SortType.Descending, 0, PivotLineType.Regular, "C3");

pTable.RefreshDataOnOpeningFile = true;
pTable.CalculateData();
book.Save("out1.xlsx");

The issues you have found earlier (filed as CELLSNET-47811) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi