完整的 代码
- /// <summary>
- /// Get filterred values from a column
- /// </summary>
- /// <param name="column"></param>
- /// <returns></returns>
- private List<object> GetFilteredValues(int column)
- {
- List<object> filterValues = null;
- SheetView sv = fpSpread1.ActiveSheet;
- if (sv.RowFilter != null && sv.RowFilter.ColumnDefinitions.Count > 0)
- {
- foreach(IFilterItem item in sv.RowFilter.ColumnDefinitions[column].Filters) {
- MultiValuesFilterItem mfi = item as MultiValuesFilterItem;
- if (mfi != null)
- {
- filterValues = new List<object>();
- int[] inRows = sv.RowFilter.GetFilteredInRows(column);
- foreach (int r in inRows)
- {
- string text = sv.Cells[r, column].Text;
- if (!filterValues.Contains(text))
- filterValues.Add(text);
- }
- break;
- }
- }
- }
- return filterValues;
- }
复制代码 |