无法访问公开接口中的所有功能?
Posted
技术标签:
【中文标题】无法访问公开接口中的所有功能?【英文标题】:Lack of access to all functions in exposed interfaces? 【发布时间】:2014-11-12 10:56:14 【问题描述】:我在 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,它旨在公开finishParagraph
和appendParagraph
,但我似乎只能访问finishParagraph
。为什么是这样?这不是一个孤立的案例 - 在我看到的所有地方,我都可以访问我无法访问的功能。
【问题讨论】:
在 Openoffice 中工作。 Libreoffice 不再有 appendParagraph 而是 finishParagraphInsert api.libreoffice.org/docs/idl/ref/… 有趣的是,我不知道 LibreOffice 的分歧如此之大。您可以将其发布为答案吗? 【参考方案1】: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 API http://api.libreoffice.org/ 如果我正在为 Libreoffice 开发宏。
【讨论】:
以上是关于无法访问公开接口中的所有功能?的主要内容,如果未能解决你的问题,请参考以下文章
PHP写的页面无法访问,报HTTP500错误,这个是怎么回事
如果我们使用默认 VPC 和安全组将公开访问设置为“否”,为啥 EC2 实例无法访问 RDS 实例?
WCF调试错误:添加服务失败。服务元数据可能无法访问。请确保服务正在运行并且正在公开元数据。