开发者

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:

  1. The docs are here (thanks to @Tim Williams for Google support).

  2. Unlike with cells, the x and y are now "normal" (column, row), not inverted. Also, the index is zero-based.

  3. To select a cell you have to use

    ThisComponent.getCurrentController().createUnoService("com.sun.star.frame.DispatchHelper").select(cell)
    
  4. To get the active cell

    oCell = ThisComponent.getCurrentSelection()
    If not oCell.supportsService("com.sun.star.sheet.SheetCell") Then
      return
    End If
    ' do stuff here
    
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜