OpenOffice Off-the-Wall: Bullet Proof Templates

How templates function differently in OpenOffice.org than they do in Office, and why OpenOffice.org's are better.

"Where are my custom formats? I spent hours getting them right. Now, when I open a new document, they're gone."

This panicked cry, or ones similar to it, are posted almost daily to the OpenOffice.org User's List. Half the time, the problem is senders have not heard of templates. The other half of the time, the senders are expecting templates to behave the same in OpenOffice.org as they do in other office suites--they don't.In both cases, the solution is to learn how OOo templates behave so you can work with them instead of against them. Some template behaviors in OOo may seem quirky, and at least one of them is a bug, but all of them are worth knowing. Once you do know them, you should find that the way OOo handles templates reduces the chances of problems and conflicts and makes documents more portable.

What's a Template?

In technical terms, a template is any OOo document with a t as the second character of its extension. For example, in Writer, the template is .stw, as opposed to the .sxw extension used for a regular document. Similarly, in Calc, the template extension is .stc.

Because this definition doesn't get us very far, let's try again. A template is a document whose design can be used by other documents of the same kind. A template also may contain an outline for the contents. This is especially helpful in Draw, whose Autopilot feature allows you to select one template for format and another for the outline. However, most of the tools for templates assume you are using them for design.

By using a template, you avoid having to design every document from scratch. Instead, you can select a template from File -> New -> Templates and Document and immediately start thinking of content. Templates are especially handy if you are working with a group of documents that should all look the same.

Every now and again, a few posters on the OOo User's List pop up to say they can't possibly use templates, because every document they do is unique. In practice, however, that is rarely true. With some intelligent planning, most users find that fewer than half a dozen templates can cover over three-quarters of their needs in any OOo application. For example, a student might find that templates in Writer for essays, lab reports, job applications and letters home are all they need. For an executive, the templates might be memos, faxes, letters and reports. And, even for unique documents, the average user is likely to want to set a default template that makes basic preferences for margins and fonts immediately available.

In fact, using templates is so much a part of the logic of OOo that even those who resist using templates cannot avoid them. Although they are unaware of the fact, what they want is not to avoid using templates, but to change the default template at will. However, as should soon become clear, this demand creates far more problems than convenience.

Setting Up a Template

Templates in OOo are designed in the same way as any other document. Virtually everything that can be customized in a document can be saved in templates, including document properties, styles and fields. Things that cannot be saved in a template are those items stored in OOo rather than the document itself. This list includes autotext and any of the gradients and other options used for the background of a draw object.

Once you are finished designing, you are ready to save, and that's where the quirkiness crops up. To start with, if you want to save the settings in Tool -> Outline Numbering, be sure to include one paragraph of each outline level in the template. Otherwise, the settings for this particular tool are lost.

More importantly, the first time a template is saved, be sure you don't save it using File -> Save or Save As. Even though these tools include the option to save as a template, a few necessary lines of XML code are not added to templates saved in this way. As a result, templates saved in this way are not listed in the Template Management system, even if they are placed in the template directories. Even worse, documents created with templates saved in this manner are not linked to the templates for automatic updating. Instead, save templates using File -> Templates -> Save. If you forget and go the logical route, you then can use the Import Templates options in the list of commands in File -> Templates -> Organize. For later saves, File -> Save or Save As are fine; they simply don't work for the first save.

The Template Management system, incidentally, is another quirk. It's a virtual directory created from the paths set in Tools -> Options -> OpenOffice.org -> Paths -> Templates. The default paths include a general path for a single- or multiple-user installation, plus a path for the individual user. You can navigate the virtual directory freely, but you cannot move outside it while inside the Template Management window. If you want a directory for sharing templates on a multiple-user system, either change the permissions on the general path so all users can write to it or add a public directory to the paths.

______________________

-- Bruce Byfield (nanday)

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Thank you for this

Anonymous's picture

Thank you for this article.
New user of OOo 3.1 on Linux
I could find the beginning of an answer about the templates here:

http://www.linuxtopia.org/online_books/office_guides/microsoft_office_to...

but that was not as detailed as your article.
OOo is really better in my view than MS Office, they don't try to protect their content (and Templates) as much as their counterpart.

Create your own template, save it! That is straight to the point. If you don't do it, the underlining hard coded template comes to the rescue. That's perfectly fine.

No more bloody normal.dot bad memories hidden in some profile folder. F... Microsoft. I will never get back, ever!

Applying a template to multiple pages within a single document

Barbara's picture

I am having trouble applying a template to more than just the first page of my document. I go to file, new, template and select the template I want to use. (Is that much right?) Then when I have typed my first page up I insert a page break and it inserts a regular page. I don't know how to apply the template to the new page. I figured there is probably a better way than just copying and pasting the first page onto a new one before I use it.

Good guide

Anonymous's picture

Thanks. I was getting myself annoyed about the whole template thing. Didn't expect there to be such a good guide on them for Open Office

From other template

Anonymous's picture

>If you want to add formats from another template, import them using Format -> Styles -> Load

In my copy of OOo 2.1, there is no "Styles" choice under the "Format" menu, much less anything about "Load". Was this a reference to an earlier version? If so, where are the relevant choices located now?

Load Styles

Anonymous's picture

Select "Format > Styles and formatting" to show the "Stylist" (this name is no longer used in OOo 2.x). On top of "Stylist" click the right most button. Select "Load Styles".

Outline numbering

Anonymous's picture

"To start with, if you want to save the settings in Tool -> Outline Numbering, be sure to include one paragraph of each outline level in the template. Otherwise, the settings for this particular tool are lost."

Is this issue fixed in OOo 2.1? I have tried to reproduced it but everything seems to work as expected.

Thanks

>"MS Office, changes to a

Anonymous's picture

>"MS Office, changes to a document can update its template."

Hum... In wich way ?

(I've tried to notice that with Office 2003, but wathever i change in a document, the template file seems to be unaffected...)

While modifying a style, you

Anonymous's picture

While modifying a style, you get this check box which if you check, promises to apply the new settings to all documents using the template you used to created the current document. Which basically means you are modifying the source template from a document that uses it!

Default template resets on rebooting the machine

Anonymous's picture

I was exploring the concept of default template to distribute macros.
There's a problem i'm facing here.

I set the template as "Default Template" following the steps described. My macros are now enabled, visible, usable in OpenOffice Writer when I open it.

Now, when I logoff or restart the machine, my template is no longer the default. I have to reset it as the default again.

Is there some way in which it remains the default template until reset by the user? Even on logging off & logging in again or rebooting the machine, the template I have set as the "Default" remains?

This is a bug in OpenOffice 1

Anonymous's picture

This is a bug in OpenOffice 1.9.87.
Tried out the same in OpenOffice 1.9.118, the template doesnot reset on a reboot.

I'm using OpenOffice 1.9.125

Anonymous's picture

I'm using OpenOffice 1.9.125 and I have the same problem. The template that I set as default resets at reboot. Very annoying.

Re: ?- Styles v. Templates

Anonymous's picture

What is the difference between a style and a template?

How does one set up either without using reveal codes? I feel like *[my own] styles and templates, are becoming some kind of "top-secret" zone (source code is open, but personal formatting codes are secret???) into which I cannot see my own formatting codes-those both active and latent at any point in a document?

thanks

Re: OpenOffice.org Off-the-Wall: Bullet Proof Templates - Why do

Anonymous's picture

Allright, I'm feeling empowered and stupid. I just want to set my default template to a simple template with Heading 1, 2, 3, and Normal styles (like that other program).
So... I follow the instructions and import the standard template (File-Template-Organize-Import) from MS Word and set it as the default. However, I don't get the styles that are in the MS Word template... just one "default" style.
What am I doing wrong?
/Mark

Re: OpenOffice.org Off-the-Wall: Bullet Proof Templates

Anonymous's picture

"Instead, save templates using File -> Templates -> Save. If you forget and go the logical route, you then can use the Import Templates options in the list of commands in File -> Templates -> Organize."

At File -> Templates -> Organize, "Printer Settings" and "Update" are the only two options present. What's wrong here?

Re: OpenOffice.org Off-the-Wall: Bullet Proof Templates

Anonymous's picture

Select a Template Folder first, then the other menu items will apear when you right click or click on "Commands".

However, it still doesn't work for me. Instead of impoerting, I get the error message saying the template already exists!

Lance DeVooght

Re: OpenOffice.org Off-the-Wall: Bullet Proof Templates

Anonymous's picture

I don't think that the template can be changed like this, or anyway using the ui ... the document will still show the original template name in the properties. This would mean that subsequent changes to the original template may unintentionally be applied to a document and maintenance of the new template will not have the desired effect. In case I am not wrong on this, there is a macro at http://www.oooforum.org/forum/viewtopic.php?p=30927#30927 which shows how to fix this.
Brilliantly readable explanation of templates which will be the short answer to the next 100 questions on oooforum on the subject.

Re: OpenOffice.org Off-the-Wall: Bullet Proof Templates

Anonymous's picture

oops .. I formatted out the quote ... this is the bit that I was concerned about! " If you want to add formats from another template, import them using Format -> Styles -> Load, and then update the document the next time you open it. If you want to change the template for a document, use the same procedure."

David French, oooforum

Re: OpenOffice Styles

Anonymous's picture

Okay, I understand all of the material in Bruce's article - well..... mostly, and will ensure I do, sooner or later. What I want to know is if I create styles in a document where for example: my first page is set at page number 1 but on page 10 I want to reset to page number 1 because it's a second chapter; then in the second chapter I want to use alternate pages with 2 columns and 3 columns. Now I can do all of that with the Stylist and inserting manual page breaks........but, as soon as I save and leave the document, the Stylist reverts to the default list and all my nice new Styles have vanished. Can I save these Styles for re-use later on and if so.........How ? Or does OO work by getting me to re-open that document where I used those Styles and extract them for use in a new document.....or what ?

Tony Young

Re: OpenOffice Styles

Anonymous's picture

Hi, Tony:

You'll find the answer in the article, although not in so many words:

1.) Create a template with all your styles and save using as File > Templates > Save.

2.) To create a new document with the same styles, go to File > New > Documents and Templates, and select the template you just saved. The document will be in the basic document format, not the template format.

I hope this is useful.

- Bruce Byfield (who really should be logging in before posting these comments)

Re: OpenOffice Styles - Not yet..perhaps I wasn't clear

Anonymous's picture

The problem with what you are suggesting is that a whole permanent template is saved with a set format according to the template...or at least that is what I think you are suggesting, and that is how I understand templates work. That's not what I need. I want to be able to work with a default document and use previously stored styles in the Stylist - if this is possible. I already have proven that I can create these styles either before or when I am working with a large document such as a scientific paper and can insert them using manual page breaks. So as I said, when I start a major document requiring these individual page formats, I can create a Style called 'Two Columns' which has two columns per page; another called 'Three Columns' with three columns per page, and then using the Stylist together with manual page breaks, I can if I want, have a succession of pages where the first is normal text, the next has three columns, the next has normal text, then two columns, a page with two columns, a page with three columns, a page with normal text etc. In other words a very random arrangement...and the next paper I write might have that sort of "column-text' structure in any random order....so a template with a pre-defined order is of no use. Assuming I understand how templates work.

It is simply that the Styles I create in the Stylist create single pages of a particular structure. Once they are in the Stylist for that document, they allow me to set an individual page into the style I want and in any order in that document. Once I have created those styles for a given document, all I do is call up the Stylist and insert them after manual page breaks. Works wonderfully, ..... but for that document only, because once I close the document and start a new text document, the list of created new styles has vanished from the Stylist.

Now what I want is for those newly created Styles to be there permanently in the Stylist (unless I delete them) so that I can apply them at random in any other document. Is this possible because it would be very, very useful and intuitive to me ? Because from your reply above, I am getting the sinking feeling that it is not........and if so, it's a pain in the neck to have to re-create these styles for each new document.

Hope this explains it better.

And thank you for replying so quickly. I am going to get on top of this because I have found that OO 1.1 is much better than either Word or WordPerfect...and I literally love WordPerfect but it has the same failing as Word...it uses proprietary formats.

Best wishes

Tony

Re: OpenOffice Styles - Not yet..perhaps I wasn't clear

Anonymous's picture

Hi,
In addition to Templates you can Load styles from an existing regular document, not a template.

If you create some nice styles in a document, and now want to use that styles (but not the templating structure) in another document (new or existing), go to the new document and Format>Styles>Load, choose a file to import from.
In this way you copy styles from one document to other.

Is this what you need?

Enrique Castro

Re: OpenOffice Styles - Not yet..perhaps I wasn't clear

Bruce_Byfield's picture

Hi, Tony:

You can, in fact, save page styles in a template, then use them in any order you want. I do it regularly.

You have two ways to do what you want:

If you want to have the same page styles available whenever you select File > New, you have to save the document as a template using File > Templates > Save, then go to File >Templates > Organize and use the Set as default template command. Once you do that, then all documents opened from File > New will have the same page styles.

Alternatively, you can save the document with the page styles you want as a template, then open a document that is linked to the template using File > New > Documents and Template.

If neither of these choices work for you, then perhaps you're forgetting to change the view in the Stylist? The Stylist opens in the Automatic view, which won't show any custom templates. You have to change the view to All or Custom Styles to see any that you've made.

Let me know if these suggestions work for you. As I said, you definitely should be able to do what you want to do.

Thanks Bruce

Anonymous's picture

Hi Bruce,

Thankyou for being so patient and trying so darn hard to solve it for me. Right, as I understand it...I really cannot do what I want to do via the Stylist which is tell it to save styles that I create in a document for use in other documents elsewhere. It is not set up that way and as I am coming to realise, the custom styles I set up in a document are tied to that (and only that) document unless I take further action. If I want those custom styles available to other documents, I have to set up a default document that contains the custom styles that I want and have clear and appropriate names for each of the required custom styles within the document. Then, clear it of all text, formatting, etc., BUT although I now have a single, blank page, the newly created custom styles will still be attached. Next, I save it as a template and call it some suitable name that I will recognise - I could even make it my default template if I wanted and was using it all the time. From what you are saying, if I then call up this template which will appear by default as a blank page, the styles are automatically tied to the template document and the various custom styles will be listed in the Stylist for me to use as required.

How am I doing ? The above might be repeating what you have just sent me, but it is in my words and if I am correct, then I have got the concept you are trying to get across to me. I am happy to keep this dialogue public because I am sure others will be interested. If that book of yours is close to production, when will it be available ? What I need is not the Star Office manual - that is almost for people who already know the stuff and want a reference manual; I need a tutorial set for more advanced work such as I am suggesting in these notes. I can easily do what I want in WordPerfect....very simple; but the template, style modes of OO are quite different and to a novice like me, the different concepts can be quite confusing. Grasping just what they can and cannot do is a problem. I know Styles is critical and very powerful but using it just as I want is another thing. However I think (?) I may have finally understood. Now to practice and try out building a template such as you suggested.

Thanks again, if I have got the above right, it is now reasonably simple and once set up is marvellously easy.

Warm regards

Tony

Re: Thanks Bruce

Bruce_Byfield's picture

Hi, Tony:

It sounds as though you have the concepts down. Incidentally, repeating them in your own words seems like a good idea, because if you can put the concepts into words, then you understand them. And, as you say, you are not the only person who has trouble with the concepts - far from it, in fact.

The book has a ways to go yet. But it's teaching me a lot, even though I thought I already knew OOo well. It's also lead me to discover all sorts of things that aren't covered by the on-line help or by any of the existing books. This column is largely a result of these discoveries.

BTW, styles will be coming up in the next few columns. I posted on a couple of mailing lists, and templates and styles were the subjects that most people wanted to learn more about. Just as importantly, styles are the key to using many other features as well.

Re: OpenOffice Off-the-Wall: Bullet Proof Templates

Anonymous's picture

So when I send the document to someone else, I would have
to find the corresponding template file and send that too ?

Re: OpenOffice Off-the-Wall: Bullet Proof Templates

Anonymous's picture

That depends.

If you're using the Default template, there should be no need.

If you don't care about whether the link to the template is preserved, just open it and choose not to update the template with the current default on the other machine.

If you want to keep the link to the template, then, yes, send it by all means.

This is an area that I should have expanded on, so I'm glad to add it here.

- Bruce Byfield

Re: OpenOffice Off-the-Wall: Bullet Proof Templates

Anonymous's picture

Sorry. I don't understand the answer. (And maybe I don't understand the question.) Why can't you just save the document and send it? Does the formatting disappear? If so, why not save it as a MS Office doc and send it that way?

Re: OpenOffice Off-the-Wall: Bullet Proof Templates

Anonymous's picture

No, the formatting (styles) that are applied go with the document. You only lose the connection to the template. This only has relevance where the template is changed (eg changing a corporate standard for title pages). So the styles in the document are a point in time view of the template styles. Templates are generally of interest to document creators and editors. For another example of the confusion that this article helps resolve see http://www.oooforum.org/forum/viewtopic.php?t=8205&highlight=
David French

Converting MS Word .dot templates...

Anonymous's picture

How OpenOffice supports templates seems sane compared to Word in an office environment (though awkward otherwise).

Anyone have links or tips on how to convert Word .dot templates? I've searched around, and couldn't find an article that was similar in depth to the good job Bruce has done (thanks!).

Are there any gotchas, or do the steps above 'just work' -- so there's no reason for a special article on converting .dot files?

Re: Converting MS Word .dot templates...

Anonymous's picture

To make OpenOffice.org aware of MS Word templates as templates, use the Import command available in File > Templates > Organize.

- Bruce Byfield
(who's feeling too lazy to log in)

Re: Converting MS Word .dot templates...

Anonymous's picture

File->AutoPilot->Document Converter....this will automatically convert Word, Excel and Powerpoint documents and templates

New location:

Anonymous's picture

New location: File->Wizards->Document Converter

Re: Converting MS Word .dot templates...

Anonymous's picture
    File->AutoPilot->Document Converter....this will automatically convert Word, Excel and Powerpoint documents and templates

Thanks, I missed that the first time around. The conversion tool is really quite nice. Any gotchas?

incorrectly converted MS Word document fields

Alexander's picture

Hi all!
There is one disappointment - this convertor does'nt convert MS Word Templates with document User Fields..
It's simply replaces this fields with its values.
Is anyone solve this problem ?

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix