Updating documents from template with soffice in headless mode

Dear all,

we use a company template that is the basis for a plurality of different letters that are processed in a backend on our server with soffice in headless mode. Basically, the header of the template comprises our standard design.

We now would like to change the template and update all of our documents on the server. On the server, no graphical UI is available.

Of course, we could download every single document and open it in writer locally and accept the changes from the template.

We are, however, looking for a batch-mode of accepting the template changes in all of our documents, which seems more future-proof.

Is that possible out of the box in headless mode?? Simply running soffice and converting a writer file to PDF does not update the header.

If not possible out of the box, could we write a script and run that on every document after changing the template with the “macro://” command line option?

I have never scripted in libreoffice. If we could achieve this by a script, could you please provide me some hints or an example?

Best regards,