可以判断下返回数组是否为 null,如果为 null 就把全部行赋给集合,代码如下:
- private void button1_Click(object sender, EventArgs e)
- {
- List<int> array = new List<int>() ;
- if (this.fpSpread1.Sheets[0].Columns[0].AllowAutoFilter)
- {
- if (this.fpSpread1.Sheets[0].RowFilter.GetIntersectedFilteredInRows()!=null)
- { array.AddRange(this.fpSpread1.Sheets[0].RowFilter.GetIntersectedFilteredInRows());
- }
- else
- {
- foreach (FarPoint.Win.Spread.Row item in this.fpSpread1.Sheets[0].Rows)
- {
- array.Add(item.Index);
- }
- }
- }
- }
复制代码 |