OpenOffice.org BASIC Guide - OpenOffice.org wiki
OpenOffice.org BASIC Guide - OpenOffice.org wiki
OpenOffice.org BASIC Guide - OpenOffice.org wiki
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Paragraph Properties<br />
The Structure of Text Documents<br />
Formatting information that does not refer to individual characters, but to the entire paragraph is considered to<br />
be a paragraph property. This includes the distance of the paragraph from the edge of the page as well as line<br />
spacing. The paragraph properties are available through the com.sun.star.style.ParagraphProperties service.<br />
Even the paragraph properties are available in various objects. All objects that support the<br />
com.sun.star.text.Paragraph service also provide support for the paragraph properties in<br />
com.sun.star.style.ParagraphProperties.<br />
A complete list of the paragraph properties can be found in the <strong>OpenOffice</strong>.<strong>org</strong> API reference. The most<br />
common paragraph properties are:<br />
ParaAdjust (enum)<br />
vertical text orientation (constants in accordance with com.sun.star.style.ParagraphAdjust).<br />
ParaLineSpacing (struct)<br />
line spacing (structure in accordance with com.sun.star.style.LineSpacing).<br />
ParaBackColor (Long)<br />
background color.<br />
ParaLeftMargin (Long)<br />
left margin in 100ths of a millimeter.<br />
ParaRightMargin (Long)<br />
right margin in 100ths of a millimeter.<br />
ParaTopMargin (Long)<br />
top margin in 100ths of a millimeter.<br />
ParaBottomMargin (Long)<br />
bottom margin in 100ths of a millimeter.<br />
ParaTabStops (Array of struct)<br />
type and position of tabs (array with structures of the type com.sun.star.style.TabStop).<br />
ParaStyleName (String)<br />
name of the paragraph template.<br />
Example: simple HTML export<br />
The following example demonstrates how to work with formatting information. It iterates through a text<br />
document and creates a simple HTML file. Each paragraph is recorded in its own HTML element for this<br />
purpose. Paragraph portions displayed in bold type are marked using a HTML element when exporting.<br />
Dim FileNo As Integer, Filename As String, CurLine As String<br />
Dim Doc As Object<br />
Dim Enum1 As Object, Enum2 As Object<br />
Dim TextElement As Object, TextPortion As Object<br />
Filename = "c:\text.html"<br />
FileNo = Freefile<br />
Open Filename For Output As #FileNo<br />
Print #FileNo, ""<br />
Doc = ThisComponent<br />
Enum1 = Doc.Text.createEnumeration<br />
' loop over all paragraphs<br />
While Enum1.hasMoreElements<br />
TextElement = Enum1.nextElement<br />
If TextElement.supportsService("com.sun.star.text.Paragraph") Then<br />
Enum2 = TextElement.createEnumeration<br />
CurLine = ""<br />
Chapter 6 · Text Documents 73