從第5列第2行到最後一列最後一行排序,先排序第2行再來第3行
ws.Cells[5, 2, ws.Dimension.Rows, ws.Dimension.Columns].Sort(new int[] { 0,1 });
/// <summary> /// Sort the range by value /// </summary> /// <param name="columns">The column(s) to sort by within the range. Zerobased</param> /// <param name="descending">Descending if true, otherwise Ascending. Default Ascending. Zerobased</param> /// <param name="culture">The CultureInfo used to compare values. A null value means CurrentCulture</param> /// <param name="compareOptions">String compare option</param> public void Sort(int[] columns, bool[] descending=null, CultureInfo culture=null, CompareOptions compareOptions=CompareOptions.None)