回复 4楼swejet的帖子
需要使用把 SortRange 方法把排序范围全部包含进来,经验证以下代码可以解决您的问题:
- public MainPage()
- {
- InitializeComponent();
- gcSpreadSheet1.ActiveSheet.Cells[0, 0].Value = 1;
- gcSpreadSheet1.ActiveSheet.Cells[1, 0].Value = 2;
- gcSpreadSheet1.ActiveSheet.Cells[2, 0].Value = 3;
- gcSpreadSheet1.ActiveSheet.Cells[0, 1].Value = "c";
- gcSpreadSheet1.ActiveSheet.Cells[1, 1].Value = "b";
- gcSpreadSheet1.ActiveSheet.Cells[2, 1].Value = "a";
- gcSpreadSheet1.ActiveSheet.ColumnCount = 3;
- gcSpreadSheet1.ActiveSheet.RowCount = 4;
- }
- private void Button_Click(object sender, RoutedEventArgs e)
- {
- gcSpreadSheet1.Sheets[0].SortRange(0, 0, this.gcSpreadSheet1.ActiveSheet.RowCount, this.gcSpreadSheet1.ActiveSheet.ColumnCount, true, new SortInfo[] { new SortInfo(0, false) });
- gcSpreadSheet1.Invalidate();
- }
复制代码
为了给你提供更优质的服务,请对本次服务进行评分。我们会认真对待你提出的宝贵意见,谢谢
|