[Libreoffice-bugs] [Bug 50699] Template Changer: Allow ability to change a document's associated template

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Thu Dec 20 00:51:04 UTC 2018


https://bugs.documentfoundation.org/show_bug.cgi?id=50699

--- Comment #60 from Gerhard Weydt <gerhard.weydt at t-online.de> ---
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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20181220/6c612e38/attachment-0001.html>


More information about the Libreoffice-bugs mailing list