jaeho 님, 안녕하세요.
그레이프시티입니다.
SortInfo 배열을 활용하여 특정 범위의 행을 정렬하실 수 있습니다.
하기 샘플 코드에서는 컬럼 B의 헤더를 클릭할 때마다 첫행부터 100번째 행만 오름차순, 또는 내림차순으로 정렬되도록 작성되었습니다.
샘플 코드를 개발 시 참고 부탁드립니다.
fpSpread1.CellClick += FpSpread1_CellClick;
bool ascending = true;
private void FpSpread1_CellClick(object sender, FarPoint.Win.Spread.CellClickEventArgs e)
{
if (e.ColumnHeader && e.Column == 1)
{
// Column B를 기준으로, 0행부터 100행까지를 내림차순으로 정렬합니다.
FarPoint.Win.Spread.SortInfo[] sorter = new FarPoint.Win.Spread.SortInfo[1];
sorter[0] = new FarPoint.Win.Spread.SortInfo(e.Column, ascending, System.Collections.Comparer.Default);
fpSpread1.ActiveSheet.SortRows(0, 100, sorter);
fpSpread1.ActiveSheet.Columns[e.Column].SortIndicator = ascending ? FarPoint.Win.Spread.Model.SortIndicator.Ascending : FarPoint.Win.Spread.Model.SortIndicator.Descending;
ascending = !ascending;
}
}
관련 내용은 아래에 링크된 도움말 문서에서도 확인하실 수 있습니다.
- Spread.NET V15 WinForms | Sorting Rows, Columns, or Ranges
감사합니다.
그레이프시티 드림