Jean Hollis Weber wrote:
Returning to a rather old thread, which I haven't had time to deal with
until now.
On 21 Jan 2009, T. J. Frazier wrote:
... the given example code, to re-enable template updating, doesn't
work under 3.0.0 ...
In 0210WG3, the cautionary note, about killing updates if you say "No"
to the "Update Styles" message, has been entirely omitted. That is
rather a pity, since (a) the kill still happens under 3.0.0, and (b)
those "how to add a subroutine" instructions are beautiful.
You are right, and I will be restoring that note in all relevant places
of the V3 books as I find time.
Of course, Andre has given us an easy way to reestablish the updating,
by reassigning the template to the document. Adding a note to mention
that is probably a good idea.
Andre's method works for Writer, but not for Calc, Impress, or Draw --
or is limited; the "Assign template (current document) choice does not
appear, though the "Assign template (folder) choice is there.
So in the Calc, Impress, and Draw Guides I will need to include code.
In the unlikely event that you want to include code, the following
(borrowed from the TC) works under 3.0.0, exactly according to the 2.x
directions:
Sub FixDocV3
'set UpdateFromTemplate
oDocSettings = ThisComponent.createInstance(
"com.sun.star.document.Settings" )
oDocSettings.UpdateFromTemplate = True End Sub 'FixDocV3
Thanks!
--Jean
Jean,
Several small points:
1) About André's Template Changer: AFAIK, even the batch mode will only
process Writer docs (.odt, .odm, .sxw, and .ott). Only these will be
added to the list of files to be assigned a template. Currently (looking
at the code for V1.2.3), Calc, Draw, and Impress are out of luck, I think.
2) André usually has a very good reason for what his code does or
doesn't do, as I have found out the hard way. I will poke around in
non-Writer docs that use templates, but this will be hampered by my
massive ignorance ("Calc has templates?" :-O ), so it will take a while.
My best guess, going in, is that if the document types (.ods, &c.)
support the service and methods used (i.e., don't give an error), then
the subroutine will work with them, too.
3) In my email, the subroutine is missing a newline character before the
last line ("End Sub"). The Basic compiler is sure to complain bitterly
about that.
--
T. J. Frazier
Melbourne, FL
(TJFrazier on OO.o)