2011-05-10 75 views

回答

4

不是一个真正的答案 - 只是一个注释代替,以撞了这个问题,并希望得到一个答案:)

这可能与拥有宏设定的权限做,例如:

Can't execute macro from command line (View topic) • OpenOffice.org Community Forum

编辑:事实上,它似乎是不可能调用文档的宏,这是完美的安全考虑。

参见:

作为一个侧面说明,标准Module1文件可以在(在Linux上)中找到:

~/.openoffice.org/3/user/basic/Standard/Module1.xba 
~/.libreoffice/3/user/basic/Standard/Module1.xba 

并注意.xba实际上是一个XML文件,其中包含基本宏源,如:

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> 
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Module1" script:language="StarBasic">REM ***** BASIC ***** 

Sub Main 

End Sub</script:module> 

不幸的是,仅仅复制到相应目录(以下,在扩展)不起作用,如下面的命令行片段..

sudo mkdir /usr/lib/libreoffice/share/extensions/mytest 
sudo cp ~/.libreoffice/3/user/basic/Standard/Module1.xba /usr/lib/libreoffice/share/extensions/mytest/MyTestModule.xba 
sudo sed -i 's/Module1/MyTestModule/g' /usr/lib/libreoffice/share/extensions/mytest/MyTestModule.xba 

所以我想唯一的办法就是在OpenOffice的手动添加/允许宏,然后可能找到相应的.xba的存储位置,并在那里更改它们的代码(如果只需要使用命令行)...

也许使用Python - OpenOffice.org Wiki是更加开放的外部脚本方法 - 但它需要你开始OpenOffice作为服务器...

+1

是的。我为xba文件准备了ERB模板并将其写入'〜/ .openoffice.org/3/user/basic/Lib/Statements.xba' 但我也更新了 '〜/ .openoffice.org/3/user/basic/Lib/script.xlb'和'〜/ .openoffice.org/3/user/basic/script.xlc' – Vlad 2011-06-07 20:37:04

+1

因此不需要手动添加/允许OO中的宏 – Vlad 2011-06-07 20:43:49

+1

感谢您的评论, @Vlad,很高兴有这些文件列出...顺便说一句,从来没有听说过ERB模板,我想这是[Erubis](http://www.kuwata-lab.com/erubis/users-guide.html),稍后阅读:)干杯! – sdaau 2011-06-09 12:57:28

相关问题