Spire.Spreadsheet is a powerful component to view spreadsheet. As a standalone spreadsheet class library, Spire.Spreadsheet is a companion component to Spire.XLS, which mainly focus on how to display spreadsheet.

Mon Mar 23, 2020 12:21 pm

HI,

i want to sort a range, but the column for sorting is not the first in the range.

GH

GHWels
 
Posts: 90
Joined: Sun Nov 23, 2014 7:22 pm

Tue Mar 24, 2020 6:14 am

Hello,

Thanks for your inquiry.
You mean you want to sort the specified column instead of the first column of the selected range, right? Here I uploaded my testing project for your reference, please directly run it on your side.
http://www.e-iceblue.com/downloads/demo/20988Demo.zip

If this is not what you want, please provide more details about your requirement, such as your input file and the effect you expect to achieve.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Tue Mar 24, 2020 7:17 am

Hi,

Thanks for the quick reply and it is almost the solution I need.
However, the range is not sorted, but the columns are sorted, including the heading.

GH

GHWels
 
Posts: 90
Joined: Sun Nov 23, 2014 7:22 pm

Tue Mar 24, 2020 10:05 am

Hello,

Thanks for your prompt response.
Sorry at present our Spire.Spreadsheet doesn't support sorting only the data in the selected range. We are considering adding this feature to our further upgrade list with the ticket SPREADSHEET-158. If it can be achieved in the future, we will let you know.
Sorry for the inconvenience caused.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Thu Apr 23, 2020 11:32 am

Hello,

Thanks for your patient waiting.
Glad to tell you that we just released Spire.Office Platinum Version:5.4.2, which supports sorting only the data in the selected range. Welcome to download it from the following links.
Website link: https://www.e-iceblue.com/Download/down ... t-now.html
Nuget link: https://www.nuget.org/packages/Spire.Office/5.4.2

Code example:
Code: Select all
var range = spreadsheet.Worksheets[0].GetSelectedRange();
//Start from 0, 1 means the second column in the range
int sortIndexs = new int[]{1,};
var sortOrders = new Forms.SortOrder[]{ Forms.SortOrder.Descending };
range.Sort(sortIndexs, sortOrders, SortOrientation.Vertical, false);


Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Mon Apr 27, 2020 3:55 am

Hello,

Hope you are doing well.
Have you tested the new feature? Does it meet your needs?
Thanks in advance for your feedback.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Return to Spire.Spreadsheet