0

我正在使用 OO 3.0 并根据官方 openoffice 文档(http://wiki.services.openoffice.org/wiki/Documentation/BASIC_Guide/StarDesktop)来替换文档,这是所需的代码:

Dim Doc As Object
Dim Dummy() 
Dim Url As String
Dim SearchFlags As Long

SearchFlags = com.sun.star.frame.FrameSearchFlag.CREATE + _
              com.sun.star.frame.FrameSearchFlag.ALL
Url = "file:///C:/test.odt"
Doc = StarDesktop.loadComponentFromURL(Url, "MyFrame", SearchFlags, Dummy)
MsgBox "Press OK to display the second document."

Url = "file:///C:/test2.odt"
Doc = StarDesktop.loadComponentFromURL(Url, "MyFrame", SearchFlags, Dummy)

我试过了,但它不起作用,从 VB 和 OO Basic 都试过了我错过了什么?(我使用所有标志 23+8 甚至 55 作为搜索标志掩码)

4

1 回答 1

0

在阅读了更多示例脚本后,我尝试手动设置名声:

vFrame = ThisComponent.CurrentController.Frame 
REM Here we set the frame name manually 
vFrame.setName("MyFrame") 

虽然使用 loadComponentFromURL 似乎不会更改框架名称,但使用 setName 确实会更改框架名称,因此在第一次调用 loadComponentFromURL 后,我使用 setName 更改了框架,从现在开始它按预期工作

于 2011-01-16T23:14:13.150 回答