【问题标题】:Getting document path in Basic in LibreOffice macro在 LibreOffice 宏的 Basic 中获取文档路径
【发布时间】:2014-09-16 02:51:45
【问题描述】:
我知道这个问题已经得到解答,但给定的解决方案对我不起作用。给定的解决方案是:
Dim oDoc As Object
Dim Path$
oDoc = ThisComponent
Path$ = oDoc.getURL()
实际上,这会为我返回一个空字符串 ("")。有什么我错过的吗?
我在 Kubuntu 12.04 上使用 LibreOffice 4.3.1.2。
感谢您的帮助!
【问题讨论】:
标签:
libreoffice
openoffice-basic
openoffice-base
libreoffice-base
libreoffice-basic
【解决方案1】:
如果你运行它会发生什么?
If oDoc.HasLocation() Then
Print "The Document URL is " & oDoc.getURL()
Else
Print "The document has not yet been stored"
End If
【解决方案2】:
如果我编译宏,它工作得很好,如果我调试未编译的宏,它就不起作用。
【解决方案3】:
当然,因为调试环境 Parent 和你的 Document Parent 不一样。