public class CustomSortComparer : IComparer
{
public int Compare(object x, object y)
{
double xConvert = Convert.ToDouble(x.ToString());
double yConvert = Convert.ToDouble(y.ToString());
return Convert.ToInt32(xConvert - yConvert);
}
}
gcSpreadSheet1.Sheets[0].SetText(0, 0, "1");
gcSpreadSheet1.Sheets[0].SetText(1, 0, "10");
gcSpreadSheet1.Sheets[0].SetText(2, 0, "2");
gcSpreadSheet1.Sheets[0].SetText(3, 0, "20");
gcSpreadSheet1.Sheets[0].SetText(4, 0, "3");
gcSpreadSheet1.Sheets[0].SetText(5, 0, "30");
gcSpreadSheet1.Sheets[0].SortRange(0, 0, 6, 1, true, new GrapeCity.Xaml.SpreadSheet.Data.SortInfo[] { new GrapeCity.Xaml.SpreadSheet.Data.SortInfo(0, false,new CustomSortComparer()) });
Public Class CustomSortComparer
Implements IComparer
Public Function Compare(x As Object, y As Object) As Integer Implements IComparer.Compare
Dim xConvert As Double = Convert.ToDouble(x.ToString())
Dim yConvert As Double = Convert.ToDouble(y.ToString())
Return Convert.ToInt32(xConvert - yConvert)
End Function
End Class
GcSpreadSheet1.Sheets(0).SetText(0, 0, "1")
GcSpreadSheet1.Sheets(0).SetText(1, 0, "10")
GcSpreadSheet1.Sheets(0).SetText(2, 0, "2")
GcSpreadSheet1.Sheets(0).SetText(3, 0, "20")
GcSpreadSheet1.Sheets(0).SetText(4, 0, "3")
GcSpreadSheet1.Sheets(0).SetText(5, 0, "30")
GcSpreadSheet1.Sheets(0).SortRange(0, 0, 6, 1, True, New GrapeCity.Xaml.SpreadSheet.Data.SortInfo() {New GrapeCity.Xaml.SpreadSheet.Data.SortInfo(0, False, New CustomSortComparer())})