问题描述
我想从外部文件运行OpenOffice宏.喜欢:
I want to run OpenOffice macro from external file. Like:
vlad@leo ~ $ soffice macro:///home/vlad/q.vbs
推荐答案
不是真正的答案-而是评论,以解决这个问题,并希望得到答案:)
Not really an answer - just a comment instead, so as to bump this question, and hopefully get an answer :)
这可能与必须显式设置宏的权限有关,例如:
This possibly has to do with having to explicitly set permissions for macros, for instance:
无法从命令行执行宏(查看主题)•OpenOffice.org社区论坛
另请参阅:
- 自定义OpenOffice.org基本宏和库-OpenOffice.org Wiki
- OpenOffice.org论坛::通过命令行启用OpenOffice宏 .
- OpenOffice.org论坛::简单的命令行问题
- OpenOffice.org论坛::如何从Shell中的文档运行宏
- Custom OpenOffice.org Basic Macros and Libraries - OpenOffice.org Wiki
- OpenOffice.org Forum :: Enable OpenOffice Macro through Command Line.
- OpenOffice.org Forum :: simple command line question
- OpenOffice.org Forum :: HowTo Run Macros from Document from Shell
作为旁注,可以在(在Linux上)找到标准的Module1
文件:
As a side note, the standard Module1
file can be found in (on Linux):
~/.openoffice.org/3/user/basic/Standard/Module1.xba
~/.libreoffice/3/user/basic/Standard/Module1.xba
,请注意,.xba实际上是一个XML文件,其中包含Basic宏源,如:
and note that the .xba is actually an XML file, that contains the Basic macro source, as in:
<?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>
不幸的是,仅复制到相应目录(在扩展名下面)不起作用,如下面的命令行代码所示.
Unfortunately, just copying to the respective directories (below, in extensions) does not work, as in the following command line snippet..
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的存储位置,并在那里更改它们的代码(如果只希望使用命令行)...
So I guess the only way is to manually add/allow Macros in OpenOffice, and then possibly find where the respective .xba's are stored, and change their code there (if only a command line usage is desired)...
也许使用 Python-OpenOffice.org Wiki 是一种更开放的外部脚本方法-但这要求您将openoffice作为服务器启动...
Maybe using Python - OpenOffice.org Wiki is more open approach to external scripts - but it requires that you start openoffice as a server...
这篇关于是否可以从外部文件运行openoffice宏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!