OpenOffice Off-the-Wall: Bullet Proof Templates
"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.
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.
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)