OpenOffice.org BASIC Guide - OpenOffice.org wiki
OpenOffice.org BASIC Guide - OpenOffice.org wiki
OpenOffice.org BASIC Guide - OpenOffice.org wiki
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
The Structure of Text Documents<br />
Formatting<br />
There are various ways of formatting text. The easiest way is to assign the format properties directly to the text<br />
sequence. This is called direct formatting. Direct formatting is used in particular with short documents because<br />
the formats can be assigned by the user with the mouse. You can, for example, highlight a certain word within a<br />
text using bold type or center a line.<br />
In addition to direct formatting, you can also format text using templates. This is called indirect formatting. With<br />
indirect formatting, the user assigns a pre-defined template to the relevant text portion. If the layout of the text is<br />
changed at a later date, the user only needs to change the template. <strong>OpenOffice</strong>.<strong>org</strong> then changes the way in<br />
which all text portions which use this template are depicted.<br />
Note – VBA : In VBA, the formatting properties of an object are usually spread over a range of sub-objects<br />
(for example, Range.Font, Range.Borders, Range.Shading, Range.ParagraphFormat). The properties are<br />
accessed by means of cascading expressions (for example, Range.Font.AllCaps). In <strong>OpenOffice</strong>.<strong>org</strong> Basic, the<br />
formatting properties on the other hand are available directly, using the relevant objects (TextCursor,<br />
Paragraph, and so on). You will find an overview of the character and paragraph properties available in<br />
<strong>OpenOffice</strong>.<strong>org</strong> in the following two sections.<br />
Note – The formatting properties can be found in each object (Paragraph, TextCursor, and so on) and can<br />
be applied directly.<br />
Character Properties<br />
Those format properties that refer to individual characters are described as character properties. These include<br />
bold type and the font type. Objects that allow character properties to be set have to support the<br />
com.sun.star.style.CharacterProperties service. <strong>OpenOffice</strong>.<strong>org</strong> recognizes a whole range of services that support<br />
this service. These include the previously described com.sun.star.text.Paragraph services for paragraphs as well as<br />
the com.sun.star.text.TextPortion services for paragraph portions.<br />
The com.sun.star.style.CharacterProperties service does not provide any interfaces, but instead offers a range of<br />
properties through which character properties can be defined and called. A complete list of all character<br />
properties can be found in the <strong>OpenOffice</strong>.<strong>org</strong> API reference. The following list describes the most important<br />
properties:<br />
CharFontName (String)<br />
name of font type selected.<br />
CharColor (Long)<br />
text color.<br />
CharHeight (Float)<br />
character height in points (pt).<br />
CharUnderline (Constant group)<br />
type of underscore (constants in accordance with com.sun.star.awt.FontUnderline).<br />
CharWeight (Constant group)<br />
font weight (constants in accordance with com.sun.star.awt.FontWeight).<br />
CharBackColor (Long)<br />
background color.<br />
CharKeepTogether (Boolean)<br />
suppression of automatic line break.<br />
CharStyleName (String)<br />
name of character template.<br />
72 <strong>OpenOffice</strong>.<strong>org</strong> 3.2 <strong>BASIC</strong> <strong>Guide</strong> · March 2010