Apply updated template to ODT file derived from that template

If I’ve created a ODT file from a template, how can I update the page styles and paragraph styles from an updated version of the template?

In reality, I’ve got 48 documents that I’ve created from a template. I’ve changed the template slightly, and copy-pasting from each document into the template then resaving will be a pain, especially since I expect future upgrades to the template to happen as well.

I don’t mind scripting a solution in bash if that is possible.

1 Like

It all depends on how you created your documents from the template.

Ideal case

You used File>New>Templates. Your document is internally linked to the template.

When you open your document, a check is made to see if the template is the same as last time the document was opened. The test is based on last modification time of the template. If this date is more recent than the date in your document, Writer will ask you if you want to update the styles. Click the OK button and it’s done.

You don’t need to systematically update your documents to latest template state. This will be done when you open a document for editing or printing. So it can wait.

This case will work after you’ve registered your template with LO. See File>Templates>Manage Templates.

Non-ideal case

You double-clicked on your .ott template file. This created a blank document from your template but it is not internally linked to the template file.

This means there is no other way than clicking on the + icon with a down-pointing triangle at extreme right of the tool bar in the style side pane. Then, use Load Styles from Template in the drop-down menu. Don’t forget to tick Overwrite otherwise the new styles won’t replace those in the document.

You can also reattach the documents to the template. For that, install the Template Changer extension. There is a command to modify all documents in a directory but I never used it (because my documents are already linked). If it works correctly, this will spare you the pain to reattach manually your documents to the template.

Once this is done, you’ll revert to the ideal case.

If you don’t install the extension, there is no other way than doing the style update manually. Of course, macro gurus could design an ad-hoc macro, but the extension is a trusted procedure.

PS: when asking questions on this site, it is preferable to mention OS name, LO version (and save format which is .odt in your case) to obtain fit-to-the-case answers.