Reputation: 81
The situation is a handful office documents in different formats and with different layouts/contents:
{A,B,C}.odt
{D,E,F}.doc
{G,H,I}.docx
I cannot find a good way to merge all documents of either format, because there is no commandline option/tool [0,1,2] or the layout is messed up [3], e.g. ooo_cat.
The expected result should be one single file that contains the contents of the other three files without breaking the layout or other unwanted side effects. Merging the base template files into one big template is unfortunately not an option.
What is the best way to smoothly merge several documents programmatically/linux commandline?
[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
Upvotes: 1
Views: 1580
Reputation: 13790
--headless
.import uno
. Or this can be done with a Python script. A good tutorial is at http://christopher5106.github.io/office/2015/12/06/openoffice-libreoffice-automate-your-office-tasks-with-python-macros.html.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())
Upvotes: 1