Bug 50699 - Template Changer: Allow ability to change a document's associated template
Summary: Template Changer: Allow ability to change a document's associated template
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: Other All
: high enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 60660 89286 (view as bug list)
Depends on: 89445
Blocks: Templates Document-Themes UX
  Show dependency treegraph
 
Reported: 2012-06-04 14:17 UTC by Jon Grossart
Modified: 2024-01-29 08:11 UTC (History)
27 users (show)

See Also:
Crash report or crash signature:


Attachments
New version of Template Changer that resides under Files/Templates. (151.72 KB, application/vnd.openofficeorg.extension)
2014-07-21 14:41 UTC, Patrick Smits
Details
Template change dialog in MSO Word 2013 (German version) (14.62 KB, image/png)
2017-05-31 07:06 UTC, Thomas Lendo
Details
LibreOffice already asks whether styles should be updated (6.57 KB, image/png)
2018-01-15 15:31 UTC, Patrick Smits
Details
New extension Document Template Changer as a substitute (42.79 KB, application/vnd.openofficeorg.extension)
2019-02-12 22:18 UTC, Gerhard Weydt
Details
Error in extension (175.31 KB, image/png)
2019-05-20 13:11 UTC, Pierre C
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jon Grossart 2012-06-04 14:17:52 UTC
This was already a bug in OOo, but it wasn't every fixed. There is an extension for this, but it stopped being updated at LibO 3.3, and it has some issues. For example, it doesn't completely update the styles correctly.

To me, this seems like something that should be core functionality, not an add-on (or at least a default add-on).

OOo bug: https://issues.apache.org/ooo/show_bug.cgi?id=52783
Extension: http://extensions.libreoffice.org/extension-center/template-changer
Comment 1 Dan Lewis 2013-01-25 20:41:46 UTC Comment hidden (obsolete)
Comment 2 Paul Weiss 2013-02-10 00:14:49 UTC Comment hidden (no-value)
Comment 3 Thomas Arnhold 2013-02-15 12:51:59 UTC Comment hidden (no-value)
Comment 4 Jon Grossart 2013-02-25 07:32:56 UTC Comment hidden (no-value)
Comment 5 David 2013-04-20 09:25:02 UTC Comment hidden (no-value)
Comment 6 Jon Grossart 2013-04-23 00:58:54 UTC Comment hidden (no-value)
Comment 7 Thomas Arnhold 2013-04-27 07:02:37 UTC Comment hidden (no-value)
Comment 8 Thomas Arnhold 2013-04-27 07:10:00 UTC Comment hidden (no-value)
Comment 9 László Németh 2013-06-14 13:50:13 UTC Comment hidden (no-value)
Comment 10 Timur 2014-05-07 11:55:29 UTC
I support this request and suggest it be added to MAB. 

While "File > Templates" with "Organize" was available up to LO 3.6, not in LO 4.0 and 4.1 now there's "File > Templates > Manage" in LO 4.2 but it's only for a new document, not for changing template in the existing document. 

I'd only like Template Changer menus to be available in "File > Templates" like up to template-changer-1.2.6.oxt and not in "File > Send" like in template-changer-1.2.7b.oxt.
Comment 11 Joel Madero 2014-05-07 17:46:14 UTC Comment hidden (obsolete)
Comment 12 Pierre C 2014-07-21 09:36:34 UTC Comment hidden (no-value)
Comment 13 manj_k 2014-07-21 10:05:04 UTC Comment hidden (no-value)
Comment 14 Patrick Smits 2014-07-21 14:41:28 UTC
Created attachment 103193 [details]
New version of Template Changer that resides under Files/Templates.
Comment 15 Patrick Smits 2015-02-11 09:47:23 UTC
Since I use this functionality quite often, I thought that this extension was the only way to achieve it, but this functionality is in the core of LO. It resides in the dialog Styles and Formatting, icon top right, click-hold. Hope this info is of any use to visitors of this bug.

I think this bug can be closed, since the extension is obsolete now.
Comment 16 Pierre C 2015-02-11 11:41:19 UTC
@Patrick Smits
I'm not sure that it does the same things as template changer

By this way, I can load styles from a template, BUT the template file isn't linked to the document. You can see this by looking to the properties of your document (files/properties/General Tab  --> template)

So any update of your template file will not be propagated to your document.

But this UI, can be  used to add this feature. By just adding a check box "link this template to the document"
Comment 17 Timur 2015-02-11 14:49:09 UTC
(In reply to Patrick Smits from comment #15)
> Since I use this functionality quite often, I thought that this extension
> was the only way to achieve it, but this functionality is in the core of LO.
> It resides in the dialog Styles and Formatting, icon top right, click-hold.

Can you please describe it little better or attach a screenshot? 
Do you mean "Load Styles..." icon? If so, that's not the same as template changer.
Comment 18 Patrick Smits 2015-02-11 14:53:37 UTC
Timur & Pierre C: You're both right. Since the extension stopped working when upgrading to LO 4.4.0.3 I created a new bug (89286) to draw attention to this problem. In that bug Cor pointed me to a solution I didn't know about, and thought it would fix it for me, but you're both right: it doesn't.
Comment 19 Timur 2015-02-11 15:06:59 UTC Comment hidden (no-value)
Comment 20 Patrick Smits 2015-02-12 00:32:41 UTC Comment hidden (no-value)
Comment 21 Timur 2015-02-12 08:34:34 UTC Comment hidden (no-value)
Comment 22 Patrick Smits 2015-02-12 14:17:11 UTC Comment hidden (no-value)
Comment 23 Joel Madero 2015-02-14 17:06:03 UTC Comment hidden (no-value)
Comment 24 Pierre C 2015-02-16 18:28:48 UTC Comment hidden (no-value)
Comment 25 Joel Madero 2015-02-16 18:49:03 UTC Comment hidden (no-value)
Comment 26 Pierre C 2015-02-16 19:56:47 UTC Comment hidden (no-value)
Comment 27 Joel Madero 2015-02-16 20:20:54 UTC Comment hidden (no-value)
Comment 28 Pierre C 2015-02-16 20:27:25 UTC Comment hidden (no-value)
Comment 29 Joel Madero 2015-02-16 20:56:27 UTC Comment hidden (no-value)
Comment 30 Jon Grossart 2015-02-16 22:41:52 UTC
Since it's my bug, and it should be core functionality, and it was imported from the old tracker, I've updated it to LibreOffice.

The reasons for that over writer, is that Impress also uses templates, and this functionality should exist there as well.

So, Writer and Impress both need it.

The extensions at best is a short term workaround in any fashion, as it should be core functionality as it ties in so explicitly with templates and styles.
Comment 31 Patrick Smits 2015-02-20 11:10:33 UTC Comment hidden (no-value)
Comment 32 Samuel Mehrbrodt (allotropia) 2016-06-07 14:54:19 UTC
I don't think it's reasonable to implement this. A template can contain any content, not only style definitions. What would you do with the content of a template when changing a document's template?

A proper way to implement this is Document Themes. See bug 90497.
Comment 33 Zenaan Harkness 2016-08-29 13:37:01 UTC
Samuel (comment #32), I disagree, but with proviso, refer: bug #101774 - I think this is the way to approach this bug #50699.
Comment 34 Zenaan Harkness 2016-08-29 13:39:25 UTC
As in, once bug #101774 is implemented, then "template changer" will become much easier to implement: the template or master document can either directly define entities, or somehow link to an "entity template" (which is just a collection of named content).

So I think this bug should stay open.
Comment 35 Samuel Mehrbrodt (allotropia) 2017-01-19 13:50:48 UTC
So I discovered we also have "Load Styles..." in Writer in the Styles menu. Using that, you can load Styles from another document into the current one.

Is that an acceptable solution? Or is there something we can improve in that feature
Comment 36 Pierre C 2017-01-19 14:20:29 UTC
If we load styles from a document or a template, the two documents are not linked.
A change in the source document's (or template) styles will not be propagated to the other.

When you create a document from a template. Each change to the template will be copied to the document when you (re)open it.

The link can be seen to property doc tab (file/properties/tab General, line template) If this line is blank there is no link with a template)
If a template is shown here this mean taht this doc is linked to this template.

IMHO, here, the UI should allow to unlink the template, or link a(nother) template with a browse button
Comment 37 Patrick Smits 2017-01-19 14:51:56 UTC
Hi Samual,

I agree with Pierre C.

A template is not just solely about text styles. When you create a document from a template, it contains all the styles and formatting as intended. In many organizations it may even contain text, headers, footers, logo's or any other common information that may not change for similar documents.

Many organizations rely on templates for a uniform presentation and work flow.
Comment 38 Pierre C 2017-01-19 15:09:43 UTC Comment hidden (no-value)
Comment 39 Patrick Smits 2017-01-19 15:15:56 UTC Comment hidden (no-value)
Comment 40 Patrick Neve 2017-03-05 23:40:20 UTC Comment hidden (no-value)
Comment 41 Thomas Lendo 2017-05-31 07:06:29 UTC
Created attachment 133738 [details]
Template change dialog in MSO Word 2013 (German version)

First tab is "Templates" where a text field let the user change the template of the document which is open just now. With a checkbox the user can define whether the styles of the template should be loaded automatically if they change.
Comment 42 Thomas Lendo 2017-08-22 11:41:49 UTC
Since "Template Changer" at LibO's extension website isn't working as intended (because 1) it doesn't link or change the template link that is visible in File > Properties... > General > Template, 2) you got an error and some styles are not updated and 3) the updated extension version 1.2.7d isn't available officially), it's no argument anymore that an extension instead of a built-in solution for the need described in this bug is the right way. (That is what I hear when talking about Template Changer with others in the community.)

What a solution should be able to do:
- Loading of styles that are part of a template file (can also be done with "Styles & Formatting" sidebar > Load styles...).
- Loading of header/footer that are part of a template file (cf. https://bz.apache.org/ooo/show_bug.cgi?id=94360).
- Loading of macros that are part of a template file.
- Updating the <meta:template> tag in meta.xml.
- Possibility to change the template via file menu and/or file properties dialog with a simple file explorer search window.
Comment 43 Heiko Tietze 2018-01-13 10:59:26 UTC
To summarize the discussion: It's requested to change the document appearance beyond just styles (c35) via template for Writer and Impress (c39). Additionally, some comments request also that changing the template later should affect the document (c36). There is an extension as workaround (c14).

(In reply to Thomas Lendo from comment #42)
> What a solution should be able to do:
> - Loading of styles that are part of a template file (can also be done with
> "Styles & Formatting" sidebar > Load styles...).
> - Loading of header/footer that are part of a template file (cf.
> https://bz.apache.org/ooo/show_bug.cgi?id=94360).
> - Loading of macros that are part of a template file.
> - Updating the <meta:template> tag in meta.xml.
> - Possibility to change the template via file menu and/or file properties
> dialog with a simple file explorer search window.

Good start, and some questions:

* Feature: Do we really want this workflow? Should document and template be linked so that changes to the template become effective later?
* Scope: How about textboxes, containing the company address for instance? We can start with a basic set of course.
* Workflow: How do we edit the template? We could ask the user whether a template should be opened and edited as it or applied to the current document. Alternatively an extra command "Apply template" could be better. The integration into the template manager is unclear.


PS: I tagged all not utterly needed comments with no-value to improve the readability of this ticket; don't take this as any valuation.
Comment 44 Heiko Tietze 2018-01-13 14:34:22 UTC
*** Bug 89286 has been marked as a duplicate of this bug. ***
Comment 45 Pierre C 2018-01-13 16:34:17 UTC
>* Feature: Do we really want this workflow? Should document and template be linked so that changes to the template become effective later?

This is the current behaviour !
If you use a template, the new document created with this template is linked to it ?
each modification of the template will be propagated to your document when you open it and you answer yes when UI ask you so.

Anyone want to break this feature ?

16 user folows this bug. Template changer was one of the most used extension (now its broken since LO 4)

It is also a feature request for AOO (https://bz.apache.org/ooo/show_bug.cgi?id=52783) with 18 votes.

This feature exists in M$ office for ages

Yes, I think it's a "must have" for advanced users
Comment 46 Patrick Smits 2018-01-15 14:22:05 UTC
(In reply to Thomas Lendo from comment #42)
> Since "Template Changer" at LibO's extension website isn't working as
> intended (because 1) it doesn't link or change the template link that is
> visible in File > Properties... > General > Template, 2) you got an error
> and some styles are not updated and 3) the updated extension version 1.2.7d
> isn't available officially)

Hi Thomas,

Version 1.2.7d is available at https://bugs.documentfoundation.org/show_bug.cgi?id=60592#c16.

Today I tried to make 1.2.7c and d available at the Extensions repository, but I couldn't find a way to add it to https://extensions.libreoffice.org/extensions/template-changer.
Comment 47 Patrick Smits 2018-01-15 15:30:37 UTC
(In reply to Heiko Tietze from comment #43)
> * Feature: Do we really want this workflow? Should document and template be
> linked so that changes to the template become effective later?

I a new file is derived from a template (via the File > Templates > Manage Templates menu of File > New > Templates menu), the file is already linked to the template. 

This can be checked via File > Properties > General > Template.

So nothing new here.

> * Scope: How about textboxes, containing the company address for instance?
> We can start with a basic set of course.

Templates are all about standardization, not just styles, but also headers, footers, text boxes etc.

To get a good impression about what should be included, please check
https://templates.office.com

> * Workflow: How do we edit the template? We could ask the user whether a
> template should be opened and edited as it or applied to the current
> document. Alternatively an extra command "Apply template" could be better.
> The integration into the template manager is unclear.


Templates can be edited via Manage Templates. Click right on a template and select Edit.

If a template is edited and a linked file is opened LibreOffice already asks whether styles should be updated. See attachment.
Comment 48 Patrick Smits 2018-01-15 15:31:36 UTC
Created attachment 139112 [details]
LibreOffice already asks whether styles should be updated
Comment 49 Thomas Lendo 2018-01-15 21:09:41 UTC
(In reply to Heiko Tietze from comment #43)
> * Feature: Do we really want this workflow? Should document and template be
> linked so that changes to the template become effective later?
As Pierre C said in comment 45 and Patrick Smits in comment 47, the current workflow with the extension is sufficient and need not to be changed. Please test the extension and you will see. For a developer, the extension can be the reference.

> * Scope: How about textboxes, containing the company address for instance?
> We can start with a basic set of course.
As far as I know, textboxes and other objects are not in the scope of the extension. I wouldn't extend the scope of the feature by now. It worked very well till now.

> * Workflow: How do we edit the template? We could ask the user whether a
> template should be opened and edited as it or applied to the current
> document. Alternatively an extra command "Apply template" could be better.
> The integration into the template manager is unclear.
As Patrick Smits said in comment 47, nothing has to be changed in the template manager or in the workflow with linked files. You can edit a template with the template manager. Editing the template always opens the current template available in the template manager.
The only new that has to be implemented is the place where the link to a template can be applied or changed or deleted (as I said in the last point in my comment 42).
Comment 50 Cor Nouws 2018-01-24 09:07:31 UTC
a template changes that does not have the ability/function to change the linked template is a bad idea.
Comment 51 Cor Nouws 2018-01-24 09:08:01 UTC
(In reply to Cor Nouws from comment #50)
> a template changes that does not have the ability/function to change the
> linked template is a bad idea.

a template changes => a template changer
Comment 52 Jon Grossart 2018-02-06 06:18:48 UTC
Most of the functionality to implement this enhancement are already present.

1. if a template is updated, LibreOffice already asks if you want to update the styles when you open a document based on it
2. there is already code to manually load/update styles.

What would be needed in the GUI to allow someone to change the associated template and the code to call the exist code to update the styles (which could probably even be a force close/reopen since that code path already does that in some way).
Comment 53 Thomas Lendo 2018-02-08 11:02:39 UTC
I haven't said much in the design meeting yesterday as all was said in this long bug report. I hope Stuart will read the comments and maybe test the extension so that we have another opinion.

Misunderstandings
-----------------
Second hope is that nobody closes this long-standing issue without knowing what the extension already did and does (I assume that because of the comments that were made) and what good help it is for current extension users. I explained the problems with the extension in comment 42. And additionally: The original author has no interest in the extension anymore.

Naming/scope
------------
Third, I wouldn't attach importance to the wording "template". Template, style, document theme--nothing but smoke and mirrors. Precisely the extension is more a "styles changer" based on a specific template file. That's wanted as core feature in LO. (I don't know what the extension does, someone who can read the code should evaluate that.)

MSO
---
I tested MSO Word 2013 and only styles (paragraph, character, list and table) will be imported or updated. No page content, no page (style) definitions, no pictures, no frames, no objects, no fields, no header data, no footer data, no file properties (like title or company) will be changed or touched.

UI
--
What design team should discuss at a starting point is where should the template/style association can be edited in the GUI. (See last sentence in comment 49 or comment 52 or last point in comment 42.)
Comment 54 Cor Nouws 2018-02-08 12:47:15 UTC
Thanks for your summary, Thomas,

(In reply to Thomas Lendo from comment #53)

> Misunderstandings
> -----------------
> Second hope is that nobody closes this long-standing issue without knowing
> what the extension already did and does (I assume that because of the
...

In general the "I don't get this issue and don't need it, so close the issue"-rate is very low here :)

> additionally: The original author has no interest in the extension anymore.
...

For me it is marked as (possibly) todo.

> MSO
> ---
> I tested MSO Word 2013 and only styles (paragraph, character, list and
> table) will be imported or updated. No page content, no page (style)
...

Which is logic. MsOffice doesn't have page styles (poor users), and those and content of the page styles (such as images in headers) is therefore not imported.

> UI
> --
> What design team should discuss at a starting point is where should the
> template/style association can be edited in the GUI. (See last sentence in
> comment 49 or comment 52 or last point in comment 42.)

Good idea. IMO.
Comment 55 Paul 2018-02-17 12:42:40 UTC
Hi guys,

This is an important feature for me. IIUC, there seems to be some controversy over what changing the underlying document template should do.

The current LO scheme, of asking to update Styles only, is to my mind the correct one. Content built into a template is never written over an existing document, only styles are.

So then, what's the need of changing the underlying template? So that a document's styles can stay synced with a template of choice.

The current problem comes when a document is radically changed. For instance, I recently took a long document and changed it from a normal 8.5x11 page to a 2-up 5.5x8.5 mirrored book format, and chose an inverted color scheme for readability. Virtually all the styles were affected, and now I dare not sync that document to its original template, which it is stuck with. I want to assign a "graybook" template to it, but cannot. Any improvements I make to my graybook template cannot be carried over to any document not bearing its formal lineage.

The alternative, I guess, would be to copy/paste all document contents to a blank "graybook" document and resave, but I'm not sure all content, such as foot/endnotes, would make the transition. Something that radical, IMO, should not be necessary.

So the issue of changing templates, in my mind, is about Styles, and nothing more. Themes is a related but subtly different concept, whereby a document's text styles can be quickly changed, with visual feedback on the fly, without affecting page settings. We can approximate this by use of different templates, but Themes makes the function much more accessible, IME.

My vote would be that this is core functionality. It could be done in several ways, but I think the most intuitive would be at the Manage Templates dialog, where an "Apply Template to Current Document" command could be added.

BW
Comment 56 Heiko Tietze 2018-02-21 19:43:09 UTC
Paul's comment 55 sounds like the best compromise here. Everything that is a style is taken from the template and gets updated when the template changes. All other features such as fields, shapes, or images are ignored. Sounds very much like the experimental document theme and why should both do the same?
Comment 57 Cor Nouws 2018-02-24 20:04:36 UTC
(In reply to Heiko Tietze from comment #56)
> Paul's comment 55 sounds like the best compromise here. Everything that is a
> style is taken from the template and gets updated when the template changes.

Indeed. So the associated template is changed.

> All other features such as fields, shapes, or images are ignored.

Correct.

> Sounds very much like the experimental document theme and why should both 
> do the same?

I think that once the Theme X from the available themes is applied to File Y, changes to the available Theme X won't have any effect on File Y.
Comment 58 Thomas Lendo 2018-02-25 12:32:38 UTC
(In reply to Heiko Tietze from comment #56)
> Sounds
> very much like the experimental document theme and why should both do the
> same?
I wouldn't mix template association with document theming (bug 90497 - Implementing document themes). You can choose a document theme for your document and save it as a template, then you can change the template of an existing document to this new template. Seems as completely different use cases.
Comment 59 Hamid 2018-12-16 08:12:25 UTC
Some are following this line to fix the issue. That's great. I would like to add some info from my own time I spent finding a solution, if not provided so far in the existing comments since I did not check them all. Also my opinion on the design part of it.

There is the concept of sticky templates which after creating many documents with LO just encountered recently:
https://help.libreoffice.org/Common/Open_1#Opening_Documents_With_Templates

That could easily take a person's time by updating and seeing no results. Better call it sticky trick.

Also this wiki on template management seems out of date:
https://help.libreoffice.org/Common/Template_Management
Comment 60 Gerhard Weydt 2018-12-20 00:51:04 UTC
Different strains seem to get mixed up in this discussion which should be clearly separated (details follow below). I list them because they have been alluded to somewhere, in order to get rid of most of them quickly:
1. The possibility to change a document template attached to a document, the initial reason for this bug report (for which I question the need in many cases)
2. The ability to update the styles used in a document using a model - which can be any document or a template in the way LibO uses this term
3. The use of a template to initialize some aspects of newly created documents
4. The ability to promote changes of this template to the documents attached to it

Comment #30 talks of Writer and Impress, but this is relevant for Calc and Draw as well.
Comments #32, 37 and 47 correctly state that not only styles are involved (in contrast to Comment #52 which seems to imply the contrary).

It might be useful to first recall what LibO already can do. My tests have been primarily been done with Calc, because my interest was triggered by someone asking about Calc Templates, but this may be even an advantage, as most people on this thread seem to be looking to Writer and perhaps Impress.
- There is the possibility to copy (and eventually overwrite) all styles of a document using another document (which must not be a so-called template) as a starting-point, in Writer. This would indeed be wished for for Calc, Draw and Impress too. So #2 is available for writer , but desired for the other modules.
- There is the possibilty to create document templates (in each of the LibO modules) which may be used to set many of the quite complex attributes of a new document by copying. No one in this thread seems to question the extent of the copied attributes, so we take this function as accepted. This covers #3.
- Promoting changes (#4) in a template created according to #3 is done by LibO: you will be asked if you want to accept changing all relevant settings using the template or not. This includes not only character and paragraph styles, but also footer and header settings, including attributes for the texts of the divers components of these and e.g.borders of these. Unfortunately, the text of the prompt uses the wording "update Styles", but in fact there will be done more: most (or all, I'm, not sure) settings will be changed.

So, excepting the extension of #2 to all components, question #1 remains to be discussed.
Now, looking at this question more closely:
You may well design a series of cascading templates using ever more concrete settings, and changing one of these at a parent level would probably (as I hope) trigger questions about propagating these changes at the lower level (by already existing LibO functionality). This might be a scenario for a bigger company using lots of document templates which are base on simpler models, which again use other models etc.
But I don't see a frequent need to set a different template to the document: the changes should be done by changing the settings of the parent document (which could be some steps higher in the lineage).

Thus I think that really replacing a document template by another is a very extreme and seldom occasion. It could be done, as far as I know, by the following macro, which should be located, as far as the momentary coding is used, within the document:
Sub setzeVorlageInfos

dim dt as NEW com.sun.star.util.DateTime

oDoc = ThisComponent
prop = oDoc.DocumentProperties
prop.TemplateName = "master2"	'set Name, this example fits the file name in the following statement
prop.TemplateURL = ConvertToURL("C:\Users\gerha\AppData\Roaming\LibreOffice\4\user\template\master2.ots")	'this is an example
dt = prop.TemplateDate	'Date ist set to 'zero', so there will be a prompt because of differnent time stamp
dt.Nanoseconds = 0
dt.Seconds = 0
dt.Minutes = 0
dt.Hours = 0
dt.Day = 0
dt.Month = 0
dt.Year = 0
dt.IsUTC = FALSE
' bis hier...
prop.TemplateDate = dt

End Sub

After using this macro, the document should be opened, because then the user would be prompted to apply the changes caused by the new template to the document. Thus, all necessary changes will be done.
Thus, this simple macro in combination with the existing functionality of LibO seems to me to be doing all that is necessary.
I still want to repeat that I think that there is rarely a need to change the template of a document (whereas I quite see the need for changing the existing template, a scenario which seems to be coverd by Libo standards).
But for these rare cases I think using a macro is sufficient, adding functionality to LibO core I deem not necessary.

My summary is that there is no need for a core functionality to change the link to a document template, as this seems to be a rare exigency.  The normal case would be to change the existing template; and for these extrem cases a macro is provided. ÜPerhaps I'm wrong in judging the need for changing the template. But then please provide convincing examples.
Comment 61 Gerhard Weydt 2018-12-22 23:34:19 UTC
After two or three days since I posted my comment I think it might sound a bit harsh.
In fact I am thinking about providing a new solution for this problem, which will certainly not be completely differing from Template Changer.
This extension has, as far as I now see, some shortcomings, e.g. the restriction to Writer, the cause of which I do not understand at the moment, my first tests were done in Calc and did work, and - as it seems - the assumption of always changing all files of a directory with certain extensions - , but the problem, that it no longer works, is obviously only due to the renaming of some LibO variables, I made it work in a test case by changing them.
I still think that there is not so much need for the functionality, so I'm not sure yet whether I will supply an extension with a menu entry in LibO or a simple document that includes a macro to be started from there (which nevertheless could probably be easily copied to MyMacros, although).
In any case I will only set all relevant information concerning the new template, leaving the changing of the formatting to LibO which will prompt for it when the document is opened for the next time (there's some meddling with numbering styles in Template Changer which I do not understand); I think that is the only feasible way to add a function in this quite complex situation, leaving to LibO to do the work.
I'll post a message here when the "extension" is published.
Comment 62 Pierre C 2018-12-24 16:27:05 UTC
@Gerhard Weydt
I need to link a template to a document. Mostly to re-link. Because link can be loosed by too ways (at least) :
- If you choose "don't update styles" when template has changed
- If you open and work with your document and the template is not where it should be (works on another computer, network link failed, worng configuration of templates path...)
Comment 63 Gerhard Weydt 2018-12-25 20:09:48 UTC
(In reply to Pierre C from comment #62)
> @Gerhard Weydt
> I need to link a template to a document. Mostly to re-link. Because link can
> be loosed by too ways (at least) :
> - If you choose "don't update styles" when template has changed
> - If you open and work with your document and the template is not where it
> should be (works on another computer, network link failed, worng
> configuration of templates path...)

Ok, these are convincing reasons for the need of this functionality which I asked for in comment 60. As I didn't use document templates yet, I had no experience with those situations.
I will continue to work an a solution, which in my case can only be an extension. I already could make the old template changer extension work again in my installation by changing some variable names which obviously have been changed in some version of LibO. But I also want to expand the scope to the other document types in LibO, because I don't think the restriction to Writer is crucial, and to add the feature to not only cut the coupling to a template, but even erase the information that it once was linked, which is still being kept when one has denied the question to transfer the changed formatting to the document. The question for that posed by a user was the reason I started to look into this subject.
I don't know yet whether I will be able to change the old extension or to create a new one.
Comment 64 Jon Grossart 2019-01-04 23:00:03 UTC
The main reasons to relink a document to the a different template (besides the ones where it doesn't link to a new change -- and I've definitely had template links get broken even with the template still exists) if you occasionally change your default template and want old documents to be easily updated to the new format. 

Currently, that involves:

1. load the styles from another document
2. create a document from the new template
3. copy and paste over so that the correct styles are supplied

If you just copy and paste the text over, you either keep the old text (because it keeps the extra formatting on top of the style version) or you past unformatted, but then you need to go back and fix everything.

For me, I run a small business, and there are times when I want to keep a document linked to header from a specific time, but then easily copy the document over and update to the new header as well. Think for things like generating reports and such. I need to keep both header templates around, not just change the base one.

As mentioned, writer and Impress probably need this the most, but other apps can benefit from it as well. And seeing as how the basic functionality is already in LibO (since it can update styles) and it would help give parity to Word/MS Office (which can use Quick Styles which is essentially super fast template switching with preview -- but there is an enhancement request for that), I don't see why there so much against this request.
Comment 65 Gerhard Weydt 2019-02-04 14:13:55 UTC
I now filed a new extension named "DocumentTemplateChanger", which at the moment still waits for revision before it will be published.
It works for Writer, Calc, Impress and Draw and has additional features, compared to TemplateChanger. Most important is perhaps the ability to connect again to the template if one has inadvertently answered by No when asked whether the styles sould be updated.
I hope this helps as long as there is no solution in standard LibreOffice.
Comment 66 Pierre C 2019-02-04 15:14:24 UTC Comment hidden (obsolete)
Comment 67 Gerhard Weydt 2019-02-12 22:18:34 UTC Comment hidden (obsolete)
Comment 68 Gerhard Weydt 2019-03-10 22:40:00 UTC
(In reply to Gerhard Weydt from comment #67)
> Created attachment 149243 [details]
> New extension Document Template Changer as a substitute
> 
> It has been a week that the extension was published by me, with the message
> that it had still to be revised. Nothing has happened since. I'll stick to
> the case, but meanwhile I publish the file here.

The extension is now available in
https://extensions.libreoffice.org/extensions/documenttemplatechanger
Comment 69 Pierre C 2019-05-20 13:11:37 UTC
Created attachment 151533 [details]
Error in extension
Comment 70 Pierre C 2019-05-20 13:12:45 UTC Comment hidden (obsolete)
Comment 71 Gerhard Weydt 2019-05-22 22:09:58 UTC
(In reply to Pierre C from comment #70)
> I've an error with the extension, when linking a template to a doc. (see
> attached)

Hi Pierre,

I could not contact you by direct mail in order to get a test file due to - probably - technical problems of the mail provider(s), hence I do not know which special constellation caused the error (I vainly tried to create a file which produced an error).
So I added a test to the code which simply avoids evaluating the attribute which caused the error, if it's not present, which does no harm, as the statements executed apply only to this attribute.
This is contained in the new version 1.0.2 on the extensions website. Please test your file with this new version.
Comment 72 Pierre C 2019-05-23 09:10:28 UTC Comment hidden (obsolete)
Comment 73 John 2019-10-22 15:21:23 UTC
A really long discussion. I started to read, but then stopped.

It should be considered that:

1.

Writer has built-in an option to load the styles:

  Main menu > "Styles" > "Load Styles"
  or
  "Styles" pane > "New Style from Selection" button > Load Styles

2.

Using the previous way, the template will not be "sticky", i.e. the styles in the document will not be automatically updated according to the changes in the template.

But there is nothing critical, we have another way:

  1. Copy your custom template in the Templates folder.
  2. Create new document based on this document using main menu > "File" > "New" > "Templates". Save it. (The location of the "Templates" folder could be discovered using main menu > Tools > Options > LibreOffice > Paths > Templates).
  3. Done. The template is now associated with your document. Then, if you want to de-associate them, repeat the above-mentioned steps, but now the template should be outside of the Templates folder.

Please, correct me in case it's not true - because I'm just a random guy here.
Comment 75 Gerhard Weydt 2019-10-24 15:12:08 UTC
(In reply to John from comment #73)
> A really long discussion. I started to read, but then stopped.
> 
> It should be considered that:
> 
> 1.
> 
> Writer has built-in an option to load the styles:
> 
>   Main menu > "Styles" > "Load Styles"
>   or
>   "Styles" pane > "New Style from Selection" button > Load Styles
> 
> 2.
> 
> Using the previous way, the template will not be "sticky", i.e. the styles
> in the document will not be automatically updated according to the changes
> in the template.
> 
> But there is nothing critical, we have another way:
> 
>   1. Copy your custom template in the Templates folder.
>   2. Create new document based on this document using main menu > "File" >
> "New" > "Templates". Save it. (The location of the "Templates" folder could
> be discovered using main menu > Tools > Options > LibreOffice > Paths >
> Templates).
>   3. Done. The template is now associated with your document. Then, if you
> want to de-associate them, repeat the above-mentioned steps, but now the
> template should be outside of the Templates folder.
> 
> Please, correct me in case it's not true - because I'm just a random guy
> here.

First: A general remark: You should never comment on a text you haven't read through!
Second: What you describe in point 2 is the way to base a new document on a template. But this is not the object of the present discussion. It is concerned with associating another template to an already existing document.
Third: If you really mean what you say in point 3, then this is an impossibility: One should create a new document on a template that is not available via "File" > "New" > "Templates" by using this menu path!
Comment 76 John 2019-10-24 23:59:16 UTC
(In reply to Gerhard Weydt from comment #75)

> Second

I mean that it could be used as a workaround: instead of trying to change the template of the existing document:

1. create a new document associated with the required template
2. replace the contents of the new document with the contents of the old document (Select All > Cut > Paste).

I'm not going to say that this workaround is really good.

* First of all, it's not very quick and intuitive.
* Also, the meta-information will be lost (File > Properties > Description).

These two pitfalls weren't visible for me when I posted my previous message. And therefore I was sure that the described workaround is much better. Now I changed my mind.

> Third

Yes, you are correct. I mean that in this case the template should be launched using general-purpose file manager.
Comment 77 Gerhard Weydt 2019-10-25 23:17:27 UTC
(In reply to John from comment #76)
> (In reply to Gerhard Weydt from comment #75)
> 
> > Second
> 
> I mean that it could be used as a workaround: instead of trying to change
> the template of the existing document:
> 
> 1. create a new document associated with the required template
> 2. replace the contents of the new document with the contents of the old
> document (Select All > Cut > Paste).
> 
> I'm not going to say that this workaround is really good.
> 
> * First of all, it's not very quick and intuitive.
> * Also, the meta-information will be lost (File > Properties > Description).
> 
> These two pitfalls weren't visible for me when I posted my previous message.
> And therefore I was sure that the described workaround is much better. Now I
> changed my mind.
> 
> > Third
> 
> Yes, you are correct. I mean that in this case the template should be
> launched using general-purpose file manager.

To deal with your last two lines quickly: I still don't understand that, because the aim is to use no template or to cut the link to a used template, so why should there be the need to "launch" (whatever that means) a template?

But the main point is, and perhaps you missed it because you stopped reading somewhere, as you confessed: There is an extension doing all that is asked for, see comment 68. The workaround to create a new document based on the new template and then cpoying the content of the previous document does work, but it requires some work. I first thought that no great problem, when I stumbled over the bug report, but people reported problems with broken links (see comments 62 and following), so I realized that this could be a lot of work if many documents were afffected.
There was an older extension which did not work any longer, due to some technical reason, and the author could not be reached. So I decided to create a new extension, after I had been convinced that there was a need for it. I don't know for the moment how much I relied on his code.
The extension allows to link another template to an existing document (changing the appearance whereever changed styles are concerned), to cut the link to the template (i. e. disregard present and future changes to the template, which is , as I assume now without additional testing, the same as renouncing to update a document with respect to the template when opening it), to reactivate this link (there is no function for that in standard LibO), and to deelete the link, leaving the document as permanently stand-alone without template (again there's no LibO function.
So I think there is no need for thinking about workarounds. The extension seems to work, as 14 persons voted it up and no one voted it down; a big number of votes should not be expected for such a special feature.
Comment 78 Xisco Faulí 2019-11-29 13:27:50 UTC Comment hidden (obsolete)
Comment 79 Xisco Faulí 2019-12-03 10:20:54 UTC Comment hidden (obsolete)
Comment 80 jeroen van gorkum 2020-06-12 16:44:16 UTC Comment hidden (obsolete)
Comment 81 Gerhard Weydt 2020-06-12 20:10:40 UTC
(In reply to jeroen van gorkum from comment #80)
> what's the status on this extension for LO 6.4.4? is it available?
> maintained?
> 
> comment #68 links to a Page not found page, and a search on
> https://extensions.libreoffice.org/?q=template+changer only lists the old
> one.

It's a long discussion, and perhaps you have not read through all comments, but I have provided an extension which replaces the old extension which no longer works because of some changes in LibO which have not been reflected in the old extension. It seems that the author is no longer to be found or not replying.
You can find the link to the new extension "DocumentTemplateChanger" in comment #68. Unfortunately it seems not possible to add a link to the new extension in the old one, because one has to be the author of that to add text.
Comment 82 jeroen van gorkum 2020-06-13 17:42:04 UTC
(In reply to Gerhard Weydt from comment #81)
> It's a long discussion, and perhaps you have not read through all comments,

i've read this thread (and others about template changer) in their entirety, because i need this functionality to switch successfully from AOO to LO. 

> It seems that the author is no longer to be found or not replying. [...]
> Unfortunately it seems not possible to add a link to the new extension in
> the old one, because one has to be the author of that to add text.

of course it's not up to me, but André (author) said in bug 60592, comment 6 that his work is LGPL. so why not release a new version of Template Changer on the Extensions website that is under your control?
Comment 83 Heiko Tietze 2020-06-14 10:12:01 UTC Comment hidden (off-topic)
Comment 84 Rich R 2020-08-02 03:59:32 UTC
(In reply to Gerhard Weydt from comment #68)
> (In reply to Gerhard Weydt from comment #67)
> > Created attachment 149243 [details]
> > New extension Document Template Changer as a substitute
> > 
> > It has been a week that the extension was published by me, with the message
> > that it had still to be revised. Nothing has happened since. I'll stick to
> > the case, but meanwhile I publish the file here.
> 
> The extension is now available in
> https://extensions.libreoffice.org/extensions/documenttemplatechanger

Thank you for this! It works on single documents, but not on folders.  I use custom paths so that my templates get backed up automatically...maybe that is the problem?  As it stands, in the dialog to change directories, there is nothing in any of the dropdowns, and opening the file chooser (...)doesn't invoke the file manager.  I have LO 6.3 via manjaro still.  I set LO to use the system file chooser as I don't like the LO one, so maybe that is the case?  I am not the only one, another commentator left a review on the LO templates site having the same problem.  THanks for this extension!
Comment 85 Gerhard Weydt 2020-10-03 17:24:21 UTC
Since the extension site has been changed, the extension is available via
https://extensions.libreoffice.org/en/extensions/show/template-changer
Comment 86 emmapk1 2020-10-18 06:38:04 UTC Comment hidden (obsolete)
Comment 87 John 2020-10-28 01:59:17 UTC Comment hidden (obsolete)
Comment 88 Gerhard Weydt 2020-11-01 11:37:10 UTC
(In reply to emmapk1 from comment #86)
> This is a bug but it needs to be fixed. Template associated with document
> must accommodate changing. I have recently used an online contract
> termination template that was easy to fill in and modify. Visit
> https://www.kuendigung.services/vorlage/kuendigung/telekom. They are well
> known contract termination service provider. They use quality template to
> save our time.
I agree that it would be better to have this functionality within LibO and not only in an extension. But the example that you provide has nothing to do with a LibO template, it's a totally different type, what is often called a form. As you seem to be German or living in Germany: a form is "Formular", template is "Vorlage".
Comment 89 Gerhard Weydt 2020-11-01 11:42:42 UTC
(In reply to John from comment #87)
> (In reply to Gerhard Weydt from comment #85)
> > Since the extension site has been changed, the extension is available via
> > https://extensions.libreoffice.org/en/extensions/show/template-changer
> 
> Thanks, Gerhard.
> 
> Just in case, for a better understanding:
> 
> 1. There was an abandoned extension Template Changer by another author.
> 
> 2. Because the original extension was abandoned, Gerhard created a new one,
> DocumentTemplateChanger, and it was available via
> https://extensions.libreoffice.org/extensions/documenttemplatechanger
> 
> 3. Now Gerhard's extension changed its name back to Template Changer and it
> is available under the original url.
> 
> I hope I haven't messed anything.

That's correct. I just want to add, that the version 2.0.0 (at the original URL) was not entirely correct, of which I wasn't aware, because for a longer time I could not access the extension. A corrected version 2.0.1 is now available there.