OpenOffice 3.3 Breaks My Code
I cannot use Cells(x开发者_Python百科,y)
anymore in OpenOffice (seems to be a bug, from what I can gather googling Cells.select
). Are there any workaround for this (with different code)? I need to respond to the value returned from Cells(x,y)
of course.
The error is:
unsatisfied query of type ooo.vba.excel.XWorksheet!
Either everything changed for 3.3, or they just broke everything by accident. The most likely case is that everything I was using has been deprecated, but it might be temporarily broken.
In any case, you can no longer use the naked Cells(y,x)
. Now you have to use
Sheet = ThisComponent.getCurrentController.getActiveSheet
Cell = Sheet.getCellByPosition(x, y)
Note:
The docs are here (thanks to @Tim Williams for Google support).
Unlike with cells, the x and y are now "normal" (column, row), not inverted. Also, the index is zero-based.
To select a cell you have to use
ThisComponent.getCurrentController().createUnoService("com.sun.star.frame.DispatchHelper").select(cell)
To get the active cell
oCell = ThisComponent.getCurrentSelection() If not oCell.supportsService("com.sun.star.sheet.SheetCell") Then return End If ' do stuff here
精彩评论