您好,
可以参考以下代码- private void fpSpread1_SelectionChanged(object sender, FarPoint.Win.Spread.SelectionChangedEventArgs e)
- {
- FarPoint.Win.Spread.Model.CellRange cr;
- cr = e.View.Sheets[0].GetSelection(0);
- // label1.Text = "列:" + cr.Column + " 行:" + cr.Row;
- for (int i = cr.Column; i < cr.Column + cr.ColumnCount; i++)
- {
- for (int j = cr.Row; j < cr.Row + cr.RowCount; j++)
- {
- if (fpSpread1.ActiveSheet.Cells[j, i].Text.Length > 0)
- {
- label1.Text = fpSpread1.ActiveSheet.Cells[j, i].Text;
- }
- }
- }
- }
复制代码 |