| Hello HN community, I struggle to solve the problem in an acceptable way, so I wanted to ask if HN has any other ideas/tips/tricks? Thanks in advance :) 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. Questions: Q1) What is the best way to smoothly merge several documents [programmatically/cmd line]? Q2) The documents are generated using the process below. What is HN's way to generate nice-looking office documents with dynamic data? (Except programming/building the whole document and elements from scratch?) A document is based on a .fodt [4] template with Jinja2 templating-blocks. The generation process is: 1.) Read the .fodt template file 2.) Populate content with the Jinja2 engine and save the "rendered" .fodt file 3.) Use cmd-line libreoffice to convert the .fodt file to .odt/.doc/.docx [0] https://ask.libreoffice.org/en/question/19222/how-to-merge-multiple-documents-into-single-merged-document/ [1] https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=57435 [2] https://support.microsoft.com/en-us/help/2665750/how-to-merge-multiple-word-documents-into-one---eeekb [3] https://askubuntu.com/questions/482277/how-to-merge-odt-documents-from-the-command-line [4] https://en.wikipedia.org/wiki/OpenDocument_technical_specification EDIT: Formatting |
I did something similar to what I think you are trying to do. I basically merged data into several different documents, and then I combined those documents into a single document. I could dig up the code if you think that is something you'd be interested in, but I'm not entirely sure what your end goal is.