回复 1楼侯存龙的帖子
可以通过以下方法获取选中的所有行索引:
- private void 获取选中行ToolStripMenuItem_Click(object sender, EventArgs e)
- {
- List<int> selectedRows=new List<int>();
- CellRange[] cr = this.fpSpread2.ActiveSheet.GetSelections();
- for (int i = 0; i < cr.Length; i++)
- {
- int startRow=cr[i].Row;
- int rowCount = cr[i].RowCount;
- for (int j = startRow; j < startRow + rowCount; j++)
- {
- selectedRows.Add(j);
- }
- }
- }
复制代码 |