无法访问公开接口中的所有功能?

时间:2014-11-12 10:56:14

标签: openoffice.org libreoffice openoffice-basic libreoffice-basic

我在OpenOffice / LibreOffice Basic中编写一个相当基本的问题,我似乎无法弄清楚。我并不总是能够访问我应该具备的所有功能。这是一个例子:

Sub TestSub
    Dim doc As Object
    doc = ThisComponent  'Note that we're in LibreOffice Writer

    MsgBox(doc.Text.Dbg_SupportedInterfaces)

    doc.Text.finishParagraph(Array())  'Works OK
    doc.Text.appendParagraph(Array())  'Error, property or method not found
End Sub

doc.Text.Dbg_SupportedInterfaces属性告诉我,我应该有权访问的其中一个接口是com.sun.star.text.XParagraphAppend,这意味着要公开finishParagraphappendParagraph,但我似乎只能访问finishParagraph。为什么是这样?这不是一个孤立的案例 - 我看到的所有地方都是为了访问我无法访问的功能。

1 个答案:

答案 0 :(得分:3)

Openoffice和Libreoffice是不同的项目。这就是他们为什么会发展不同的原因,他们将来会变得更加不同。以你的例子为例,Libreoffice不再有appendParagraph,而是finishParagraphInsert。请参阅:http://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1text_1_1XParagraphAppend.html

对于BASIC开发,我建议使用像XRAY这样的调试工具。请参阅:https://wiki.documentfoundation.org/Macros此工具仅显示实际存在的属性和方法。不幸的是,Libreoffice的API文档中甚至没有更多的全局索引。因此XRAY无法直接链接到Libreoffice API文档。因此,目前我对Openoffice和Libreoffice使用https://www.openoffice.org/api/docs/common/ref/index-files/index-1.html,如果我正在处理Libreoffice的宏,请手动检查Libreoffice API http://api.libreoffice.org/

相关问题