LibreOffice 5.1 Writer:插入脚本

LibreOffice 5.1 Writer: insert script

在以前版本的 LibreOffice 中,可以从 "insert" 菜单将脚本插入 odt。

根据官方回答,此功能已删除: https://ask.libreoffice.org/en/question/67576/menu-insert-script-removed/

我该如何插入脚本?这个答案暗示的 "Writer HTML" 是什么?我在其他任何地方都找不到关于它的字眼。

如果我想避免挖掘大量的 XML,我是否只为这个功能而被迫安装早期版本的 LibreOffice?

此外,谁能解释一下此举的原因(从产品中删除现有的便捷功能)?

要在 Writer 中创建一个 HTML 文档(即 "Writer HTML"),请转到 File -> New -> HTML Document,然后就可以插入脚本了。或者,听起来您可能需要 File -> New -> XML Form Document

在我看来 Insert -> Script 仅对添加 Javascript 或类似文档有用,这似乎适合 HTML 文档或表单。所以新的变化对我来说很有意义。

要编写 Javascript ,请将代码放在 LibreOffice 用户目录下的文本文件中,如 here.[=17= 所述]

编辑:

从下面的评论来看,您似乎 inserting a directive 适合使用 JODReports。您可以改为执行以下操作吗:

Insert a FreeMarker directive in OpenOffice.org Writer from the menu Insert / > Fields / Other... (or just press Ctrl+F2), then click on the Functions tab and > select Input field. Change the field Reference to JOOScript and in the > following field Content enter the directive (e.g. "[#assign title='Mr.']").

注意:Apache OpenOffice 仍有 Insert -> Script

脚本功能仍然存在。它只是不在默认菜单中。去 Scripting LibreOffice 用于将其添加回“插入”菜单项。

这是一种将其添加回来的方法(使用版本:5.3.2.2 完成):

  1. 选择工具 - 自定义,然后单击菜单选项卡。
  2. LibreOffice Writer 菜单 中,向下滚动到插入。
  3. 菜单内容 - 条目中,向下滚动到您希望脚本项目出现在其后的任何项目。
  4. 单击添加命令
  5. 类别列表框中,选择所有类别。
  6. 命令列表框中,向下滚动到脚本
  7. 单击添加 以创建新菜单项。新菜单条目出现在 条目 列表框中。
  8. 单击确定,您就可以在任何地方插入新的脚本对象了。