[BUG] Moving Files and Templates to another system does NOT work

I have a simple scenario and I am unsure why it does not work, other than I really do not understand how LO binds or associates templates to files. The fact that the template is still identified in the properties section of the file gives me hope, but I am sure LO does not just try to associate the file name there and is using more garbage to ‘make sure’ the correct template will be applied (e.g. fullpath, etc.) Therefore, since it obviously does not work, may I ask what is the proper procedure to use, since this is not documented anywhere? I tried:

  • zip up my .odt file on old system
  • unzip .odt files on new system
  • export temlate and copy the .ott file to new system
  • import template file into new system
  • make a change to template (change heading font color), save template, close
  • open a file that uses the template on new system, check properties (correct template name is there), template update is ignored (BUG)

Please explain if this is supported or not and why.

how LO binds or associates templates to files.

If you mean the styles, they are stored in the document.

Document templates are saved in the path C:\Users\USERNAME\AppData\Roaming\LibreOffice\4\user\template, unless you have specified otherwise.
You can look it up in the Tools>Options>LibreOffice>Paths menu

Have you ever tried to copy / transfer a file directly without “ZIP”?

Which operating systems are used?

Which LibreOffice versions do you use?

Hi ebot, I am using LO 6.3 on Win10 for both systems. I transferred all my files via a cloud f/s. I uploaded from the one system and downloaded them to the other. Then using the procedure above tried to get the template to work on the new system. Even though I imported them into the new system’s writer, then opened the file that I copied over I was surprised to see that when I made a change to template and saved it, it was not later picked up by re-opening the document. As such, I am very, very confused as to HOW templates work (if they actually do). My experience with them thus far is that they are VERY FINICKY and often times, like this, do not work. Hence, just tell me know if I should make the template the default and go through the dreaded (but normal/usual) cut-n-paste nightmare to get back to where I need to be(?)!

I have verified this from the SAME system. It is easy to TEST and obviously never tested even on the same system. Scenario

  1. Install LO6.3, create new template from standard or default, name it Standart_Test, make default template
  2. Create a new document based on that template, save it somewhere, not in a dir LO uses
  3. Make an update to template, save, open doc you created, verify template update is prompted. Accept and save document.
  4. Go into template manager, export template somewhere DIRX, not an LO dir
  5. Uninstall LO, remore all the LibreOffice dir from c/Users//AppData/Roaming/ directory, to thoroughly clean uninstall (LO doesn’t), reboot, re-login
  6. Reinstall LO 6.3
  7. Import your old template, edit it and reverse change made in 3 above
  8. Open old document, template update is never prompted. Properties shows correct template name, template is in the correct dir, but totally IGNORED.

Is the template design point too narrow, or is it just me?

From experience fiddling with templates (quite similar to yours, except it was in the same system but under different accounts), I discoverd the association between a document and its template is something quite complex.

I tried patching directly the underlying XML but I made the whole thing unstable.

  • path to template in the XML is made relative to document location

    Therefore, any difference in directory structure or document storage location will prevent access to template: Writer will conclude that the template no longer exists. But Writer keeps the template association in File>Properties, just in case it comes back.

  • template change detection is based on timestamps

    Writer takes into account both modification date of the current template and the modification date of the template when document was last edited. If current template is newer than saved date, this triggers a styles update dialog.

    However, apparently, if date kept in the XML is really too old (I don’t remember how old exactly), the styles update event will not occur!

Patching manually the XML is tricky and leads to a high risk of damaging the document. Consequently, my suggestion is:

  • install DocumentTemplateChanger

  • when you have moved your templates and documents on the new system, rebase your documents with DocumentChangerTemplate’s special menu File>Templates>Change template (current document) for every document or File>Templates>Change template (folder) if all documents are in the same directory.

To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!

In case you need clarification, edit your question (not an answer which is reserved for solutions) or comment the relevant answer.

Okay, I am going to accept your answer, as most likely having explained the behavior, although I still consider it a terrible, short-sighted and narrow design point that needs fixing. The current behavior is almost useless, if I use my very loose and coarse understanding of the intention of templates (errr, to save time, but they don’t). Moreover, the tool you suggest, if it fixes even this mundane scenario, is further proof of its poor design and implementation. I would have thought a simple versioning technique would have sufficed. Trying to use system dates is just, in my mind, a really bad idea for portability. Enough said… Thanks for your time.

One last comment about “Writer takes into account both modification date of the current template and the modification date of the template when document was last edited”. As I said, I was able to replicate this issue on the same system across a uninstall/cleanse/reboot/reinstall using same directory. So its even more temperamental than I think your tests have established.

I am going to try your extension though… :slight_smile:

Just wanted to confirm with you that the extension works fine. I prefer the design to be fixed, but this is just tolerable. Thank you!

I fully agree with your assessment of the template feature “user-un-friendliness”. When I discovered templates were referenced with a relative path to the document, that was a terrible shock for me and it explained many of the problems I faced.

The relative path is a very bad idea. Since template paths are configurable in Tools>Options, Libre Office>Paths, it would have been much better to store only the template document name (without directory) in the XML and let LO find a match across the designated templates directories. Thus it could be possible to experiment with a new template version by adding a directory before the others, thus overriding a template with same name.

With regard to versioning, I’m not sure this would really change things. Modification date is a reliable way to detect changes. Many utilities, like make, rely on this and they look quite successful. I don’t see portability issues unless using local time instead of GMT.