1.FpSpread控件,指定单元格获取焦点.
Me.FpSpread1.ActiveSheet.SetActiveCell(1, 1, False)最后一个参数如果为False则,选择新的单元格时,不清除已选择的对象.
2.FpSpread控件,锁定单元格,行,列.
'锁定列
Me.FpSpread1.ActiveSheet.Columns(0, 1).Locked = True
Me.FpSpread1.ActiveSheet.Columns(3).Locked = True
'锁定行
Me.FpSpread1.ActiveSheet.Rows(0).Locked = True
Me.FpSpread1.ActiveSheet.Rows(2, 3).Locked = True
'锁定单元格
Me.FpSpread1.ActiveSheet.Cells(4, 5, 6, 9).Locked = True
'锁定区域的背景色
Me.FpSpread1.ActiveSheet.LockBackColor = Color.Red
'前景色
Me.FpSpread1.ActiveSheet.LockForeColor = Color.Blue
3.FpSpread控件,增加行和列
Me.ShowMesage(String.Format("当前有 {0} 行 {1} 列", Me.FpSpread1.ActiveSheet.Rows.Count,
Me.FpSpread1.ActiveSheet.Columns.Count))
'增加列
Me.FpSpread1.ActiveSheet.Columns.Add(Me.FpSpread1.ActiveSheet.Columns.Count, 1)
'增加行
Me.FpSpread1.ActiveSheet.Rows.Add(Me.FpSpread1.ActiveSheet.Rows.Count, 1)
Me.ShowMesage(String.Format("现在有 {0} 行 {1} 列", _
Me.FpSpread1.ActiveSheet.Rows.Count, Me.FpSpread1.ActiveSheet.Columns.Count))
4.FpSpread控件,删除行和列
Me.ShowMesage(String.Format("当前有 {0} 行 {1} 列", Me.FpSpread1.ActiveSheet.Rows.Count, _
Me.FpSpread1.ActiveSheet.Columns.Count))
Me.FpSpread1.ActiveSheet.Columns.Remove(10, Me.FpSpread1.ActiveSheet.Columns.Count - 10)
Me.FpSpread1.ActiveSheet.Rows.Remove(10, Me.FpSpread1.ActiveSheet.Rows.Count - 10)
Me.ShowMesage(String.Format("现在有 {0} 行 {1} 列", _
Me.FpSpread1.ActiveSheet.Rows.Count, Me.FpSpread1.ActiveSheet.Columns.Count))