How to detach a template?

Hi,

Let’s say I want to send an invoice to a customer, then I could create this invoice by using a template. Great, saves me some time :slight_smile: If I would open this invoice one year later and in the meanwhile the template has changed, a pop-up box will appear asking me to update the invoice. Well … as some of you might know, an original invoice should not be updated, so that is why I’m wondering if it is possible to detach a template from a document. So … I create a document based on a template, and then when it is completely finished I would like to detach the template so the document will never be updated (by mistake) anymore. Is that somehow possible?

I presently only can do it by a custom sub (“macro”). As there are disadvantages using macros, I hope someone else will know better advice. I also did not test if the document is actually and finally detached. I only tested that inserting the TemplateURL, TemplateName, and TemplaleStyle as a field after running my macro produced the emptxy text as intended. This is persistent over a store/reload cycle, however.

The sub I sketched is extremely simple:

Sub DetachTemplate()
oProp = ThisComponent.DocumentProperties
oProp.TemplateName=""
oProp.TemplateURL=""
End Sub

Thanks Lupp, that seems like a good solution. I will give it a try.

I did not test but…

Only deleting the TemplateURL and leaving the TemplateName untouched may olso break the trigger of the update suggestion, but preserve the memory of the original template.

NB: My experiments seemed to tell me that reistablishing the name and URL of a template by assigning values to the the related properties will not work.

Allright.I don’t think I’ll ever need to reestablish so I don’t think there will be any problem then.

Page 312 of Writer 4.2 Guide says:
“Updating a document from a changed template…
If you choose Keep Old Styles in the message box shown in Figure 307 after
changing the template, and then at some stage save the document, then that
message will not appear again the next time you open the document. You will not get
another chance to update the styles
from the template, although you can use the
macro given in the Note below to re-enable this feature.”

So I think your invoice will be permanently disconnected from the template if you elect to not update.

EDIT: Here’s another (simple) thought …
Open for editing your original invoice Template and save-as type .odt to a folder outwith LO’s reach, e.g. where you keep your data files. This new “working master” document will have no template link and can be used as the original to create specific invoices. If you change the Template in the future, re-create a new “working” invoice. Existing invoices will be unaffected.

Thanks for replying. You are correct, but in this case I would like to totally detach the template in advance. If I by mistake update an old file with a new template I’m kinda screwed, so I don’t want that to happen at all.

Here’s another (simple) thought … Open for editing your original invoice Template and save-as type .odt to a folder outwith LO’s reach, e.g. where you keep your data files. This new “working master” document will have no template link and can be used as the original to create specific invoices. If you change the Template in the future, re-create a new “working” invoice. Existing invoices will be unaffected.

Hi

Well … as you said an original invoice should not be updated

So my approach would be: create and send the customer a pdf. If necessary create an hybrid pdf.

At the opening in LibreOffice, Hybrid pdf file opens in calc and possible modification of the template will not cause the suggestion to update.