旧版本的Spread是Activex,具体版本不清楚。
FPSpread.SelLength的功能应该是设置在活动单元格中要选择的字符数。
本功能在ActiveX跟Spread7Form的相同功能对照表中有取得相对应的功能控件。但是具体无法实现。
ActiveX的“SelLength” 等同于 Form7的 “GeneralEditor.SelectionLength”
- Public Property SelLength() As Integer
- Get
- If MyBase.ActiveSheet IsNot Nothing Then
- Dim ct As CellType.GeneralEditor
- ' 1. 这里没有出现类型转换错误
- ct = CType(MyBase.ActiveSheet.Cells(.Row, .Col).CellType, CellType.GeneralEditor)
- Return ct.SelectionLength
- Else
- Return Nothing
- End If
- End Get
- Set(value As Integer)
- Dim ct As New CellType.GeneralEditor
- '2. 将GeneralEditor设置为数字或者文字类型单元格时,提示错误消息,不能将两种类型转换。
- If TypeOf MyBase.ActiveSheet.Cells(_Row, _Col).CellType Is CellType.TextCellType Then
- ct.EditModeCursorPosition = FarPoint.Win.EditModeCursorPosition.LastKnownPosition
- ct.SelectionLength = value
- MyBase.ActiveSheet.Cells(_Row, _Col).CellType = CType(ct, CellType.TextCellType)
- ElseIf TypeOf MyBase.ActiveSheet.Cells(_Row, _Col).CellType Is CellType.NumberCellType Then
- ct.EditModeCursorPosition = FarPoint.Win.EditModeCursorPosition.LastKnownPosition
- ct.SelectionLength = value
- MyBase.ActiveSheet.Cells(_Row, _Col).CellType = CType(ct, CellType.NumberCellType)
- End If
- End Set
- End Property
复制代码
求教,如何在Spread Form 7中实现指定单元格的SelLength功能? |
|