如何合并office文档?
How to merge office documents?
情况是几个office文档,格式不一,格式不一样layouts/contents:
{A,B,C}.odt
{D,E,F}.doc
{G,H,I}.docx
我找不到合并两种格式的所有文档的好方法,因为没有命令行 option/tool [0,1,2] 或布局混乱 [3],例如ooo_cat.
预期的结果应该是一个文件包含其他三个文件的内容,而不会破坏布局或其他不需要的副作用。不幸的是,将基本模板文件合并到一个大模板中不是一种选择。
平滑合并多个文档的最佳方法是什么programmatically/linux命令行?
[1] https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=57435
[3] https://askubuntu.com/questions/482277/how-to-merge-odt-documents-from-the-command-line
- 使用
--headless
启动 LibreOffice 监听。
- 在 shell 中交互使用 Python 并从
import uno
开始。或者这可以通过 Python 脚本来完成。 http://christopher5106.github.io/office/2015/12/06/openoffice-libreoffice-automate-your-office-tasks-with-python-macros.html. 有一个很好的教程
- 根据题目中的link[1],调用Insert -> Document这样记录Basic代码。
dim args(1) as new com.sun.star.beans.PropertyValue
args(0).Name = "Name"
args(0).Value = "file:///path/to/the_document.odt"
args(1).Name = "Filter"
args(1).Value = "writer8"
dispatcher.executeDispatch(document, ".uno:InsertDoc", "", 0, args())
情况是几个office文档,格式不一,格式不一样layouts/contents:
{A,B,C}.odt
{D,E,F}.doc
{G,H,I}.docx
我找不到合并两种格式的所有文档的好方法,因为没有命令行 option/tool [0,1,2] 或布局混乱 [3],例如ooo_cat.
预期的结果应该是一个文件包含其他三个文件的内容,而不会破坏布局或其他不需要的副作用。不幸的是,将基本模板文件合并到一个大模板中不是一种选择。
平滑合并多个文档的最佳方法是什么programmatically/linux命令行?
[1] https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=57435
[3] https://askubuntu.com/questions/482277/how-to-merge-odt-documents-from-the-command-line
- 使用
--headless
启动 LibreOffice 监听。 - 在 shell 中交互使用 Python 并从
import uno
开始。或者这可以通过 Python 脚本来完成。 http://christopher5106.github.io/office/2015/12/06/openoffice-libreoffice-automate-your-office-tasks-with-python-macros.html. 有一个很好的教程
- 根据题目中的link[1],调用Insert -> Document这样记录Basic代码。
dim args(1) as new com.sun.star.beans.PropertyValue
args(0).Name = "Name"
args(0).Value = "file:///path/to/the_document.odt"
args(1).Name = "Filter"
args(1).Value = "writer8"
dispatcher.executeDispatch(document, ".uno:InsertDoc", "", 0, args())