这需要进行几行代码来实现,先取出选中的区域,然后将该区域所有单元格的值设置给指定的TextBox:
- CellRange cr = fpSpread1.ActiveSheet.GetSelection(0);
- for (int row = 0; row < cr.RowCount; row++)
- {
- for (int col = 0; col < cr.ColumnCount; col++)
- {
- //TextBox1.Text = fpSpread1.ActiveSheet.Cells[cr.Row + row, cr.Column + col].Value;
- }
- }
复制代码 |