先将Filter中的项复制到ComboBox中:
- var items = fpSpread1.ActiveSheet.GetDropDownFilterItems(0);
- foreach (var item in items)
- {
- comboBox1.Items.Add(item);
- }
复制代码
然后在ComboBox的SelectedIndexChanged事件中进行过滤操作:
- private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
- {
- fpSpread1.ActiveSheet.AutoFilterColumn(0, comboBox1.SelectedItem.ToString(), 0);
- }
复制代码 |