[英]ActiveCell.Offset for libreoffice
如何访问LibreOffice(OpenOffice)中选定单元的附近?
我只能使用“ ThisComponent.getCurrentSelection”获得选定的单元格。
我只需要MS Excel VBA函数“ ActiveCell.Offset”的替代方法。
对我来说似乎很简单:
Function OffsetCell(col_offset, row_offset)
oSel = ThisComponent.getCurrentSelection()
oCellAddress = oSel.getCellByPosition(0, 0).getCellAddress()
oSheet = ThisComponent.CurrentController.ActiveSheet()
OffsetCell = oSheet.getCellByPosition( _
oCellAddress.Column + col_offset, _
oCellAddress.Row + row_offset)
End Function
例如,该函数可以这样使用:
Sub DisplayOffsetCell()
offset_cell = OffsetCell(2, 1)
MsgBox(offset_cell.getString())
End Sub
由于我不理解的原因,对此主题进行了大量讨论,并提出了几种复杂的解决方案:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.