[英]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.