Templates

From OpenOffice.org Wiki

Jump to: navigation, search
PAGE_TITLE: VGVtcGxhdGVz
doc OOo

Templates are named lists containing formatting attributes. They move through all applications of OpenOffice.org and help to significantly simplify formatting. If the user changes one of the attributes of a template, then OpenOffice.org automatically adjusts all document sections depending on the attribute. The user can therefore, for example, change the font type of all level one headers by means of a central modification in the document. Depending on the relevant document types, OpenOffice.org recognizes a whole range of different types of template.

OpenOffice.org Writer supports the following templates:

  • Character templates
  • Paragraph templates
  • Frame templates
  • Page templates
  • Numbering templates

OpenOffice.org Calc supports the following templates:

  • Cell template
  • Page templates

OpenOffice.org Impress supports the following templates:

  • Character element templates
  • Presentation templates

In OpenOffice.org terminology, the different types of templates are called StyleFamilies in accordance with the com.sun.star.style.StyleFamily service on which they are based. The StyleFamilies are accessed by means of the document object:

Dim Doc As Object
Dim Sheet As Object 
Dim StyleFamilies As Object 
Dim CellStyles As Object
 
Doc = StarDesktop.CurrentComponent
StyleFamilies = Doc.StyleFamilies
CellStyles = StyleFamilies.getByName("CellStyles")

The example uses the StyleFamilies property of a spreadsheet document to establish a list containing all available cell templates.

The individual templates can be accessed directly by means of an index:

Dim Doc As Object
Dim Sheet As Object
Dim StyleFamilies As Object 
Dim CellStyles As Object
Dim CellStyle As Object
Dim I As Integer
 
Doc = StarDesktop.CurrentComponent
StyleFamilies = Doc.StyleFamilies
CellStyles = StyleFamilies.getByName("CellStyles")
 
For I = 0 To CellStyles.Count - 1
  CellStyle = CellStyles(I)
  MsgBox CellStyle.Name
Next I

The loop added since the previous example displays the names of all cell templates one after another in a message box.

Details about various formatting options

Each type of template provides a whole range of individual formatting properties. Here is an overview of the most important formatting properties and the points at which they are explained:

The format properties are by no means restricted to the applications in which these are explained, but instead can be used universally. For example, most of the page properties described in Spreadsheets can therefore be used not only in OpenOffice.org Calc, but also in OpenOffice.org Writer.

More information about working with templates can be found in the Default values for character and paragraph properties section in Text Documents.

Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
Collection