We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

How to apply sorting property

Hi,

How to apply sorting in Excel file using Syncfusion xlsio engine.
I have attached the included excel sorting file.

ExcelEngine oengine = new ExcelEngine();
IApplication oApp = oengine.Excel;
oApp.DefaultVersion = ExcelVersion.Excel2007;
IWorkbook oWorkbook  =  oApp.Workbooks.Create(1);
IWorksheets osheets = oWorkbook.Worksheets;
IWorksheet  osheet = osheets .Worksheets[0];

IDataSort sorter = oWorkbook .CreateDataSorter();
1) First file related code

sorter.SortRange = osheets.Range["D1:D26"];
sortField = sorter.SortFields.Add(4, SortOn.Values, OrderBy.Descending);
sorter.Algorithm = SortingAlgorithms.QuickSort;    
sorter.Sort();

2) Second file related code

sorter.SortRange = osheets.Range["E2:E10"];
 sortField = sorter.SortFields.Add(oRange2007.Column, SortOn.CellColor, OrderBy.OnBottom);
 sortField.Color = Windows.UI.Color.FromArgb(0, 255, 0, 0);
sorter.Sort();

This code is run successfully create sorting property . but In first file ascending/descending order is not set. and second file cell color color value is not set.

Thanks
sharad kumar

Attachment: New_folder_(7)_af2396e0.rar

3 Replies

SS Sridhar Sukumar Syncfusion Team September 7, 2016 04:57 PM UTC

Hi Sharad, 
 
Thank you for contacting Syncfusion support. 
 
We have analyzed you code and found that you are trying to sort single column data. When applying sorting for single column, we have found an issue “Sorting is not applied to single column data”. So please confirm us whether you have faced the same issue in your side. if no, kindly share us the detailed information of the issue you have faced in your side. 
 
Regards, 
Sridhar S 



SK Sharad Kumar September 8, 2016 03:02 AM UTC

Hi,

I am applied sorting for single column.
My code successfully create sorting property but Ascending/descending order is not set.

Similarly in Top10 AutoFilter property percent value is not.

Thanks


SS Sridhar Sukumar Syncfusion Team September 8, 2016 02:03 PM UTC

Hi Sharad, 

 

Thank you for updating us. 

  

We were able to reproduce the problem and have logged defect report regarding this. A support incident to track the status of this defect has been created under your account. Please log on to our support website to check for further updates 

  

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents  

  

Please let me know if you have any questions. 

  

Regards, 

Sridhar S. 

SIGN IN To post a reply.
Loader.
Live Chat Icon For mobile
Up arrow icon