Difference between revisions of "Documentation/BASIC Guide/Templates"

From Apache OpenOffice Wiki
Jump to: navigation, search
Line 12: Line 12:
 
{{OOo}} Writer supports the following templates:
 
{{OOo}} Writer supports the following templates:
  
* character templates
+
* Character templates
* paragraph templates
+
* Paragraph templates
* frame templates
+
* Frame templates
* page templates
+
* Page templates
* numbering templates
+
* Numbering templates
  
{{OOo}} Calc supports the following templates
+
{{OOo}} Calc supports the following templates:
  
* cell template
+
* Cell template
* page templates
+
* Page templates
  
{{OOo}} Impress supports the following templates
+
{{OOo}} Impress supports the following templates:
  
* character element templates
+
* Character element templates
* presentation templates
+
* Presentation templates
  
 
In {{OOo}} terminology, the different types of templates are called <tt>StyleFamilies</tt> in accordance with the <idl>com.sun.star.style.StyleFamily</idl> service on which they are based. The <tt>StyleFamilies</tt> are accessed by means of the document object:
 
In {{OOo}} terminology, the different types of templates are called <tt>StyleFamilies</tt> in accordance with the <idl>com.sun.star.style.StyleFamily</idl> service on which they are based. The <tt>StyleFamilies</tt> are accessed by means of the document object:

Revision as of 10:39, 2 September 2008


Templates are named lists containing formatting attributes. They move through all applications of Apache OpenOffice and help to significantly simplify formatting. If the user changes one of the attributes of a template, then Apache OpenOffice 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, Apache OpenOffice recognizes a whole range of different types of template.

Apache OpenOffice Writer supports the following templates:

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

Apache OpenOffice Calc supports the following templates:

  • Cell template
  • Page templates

Apache OpenOffice Impress supports the following templates:

  • Character element templates
  • Presentation templates

In Apache OpenOffice 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 Apache OpenOffice Calc, but also in Apache OpenOffice 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