首页 > 解决方案 > LibreOffice Calc Basic:getCellByPosition 给出 outOfBoundsException

问题描述

我在 Calc 文件中有以下宏:

Dim oDoc as Object
oDoc=ThisComponent
Dim oSheets as Object
oSheets = oDoc.Sheets
Dim oController as Object
oController = oDoc.getCurrentController()
Dim numVisibleSheet
numVisibleSheet = oController.VisibleRange.Sheet
Dim currentSheet as Object
currentSheet = oController.ActiveSheet
currentSheet = oSheets.getByIndex(numVisibleSheet)

MsgBox "ok"
cell = currentSheet.getCellByPosition(5000, 5)
cell.setString("toto")

当我在 LibreOffice 7 上运行它时,我在 cellsuno.cxx 中得到一个“outOfBoundsException”。

我对 getCellByPosition 的使用不好吗?单元格的 x 和 y 坐标是否有界限,如果有,我该如何扩展这些界限?

谢谢!

标签: scriptinglibreofficebasiccalc

解决方案


推荐阅读