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.
You can apply all of the named properties to individual cells and to cell ranges.<br />
The Structure of Spreadsheets<br />
Note – VBA : The CellProperties object in the <strong>OpenOffice</strong>.<strong>org</strong> API is comparable with the Interior<br />
object from VBA which also defines cell-specific properties.<br />
Background Color and Shadows<br />
The com.sun.star.table.CellProperties service provides the following properties for defining background colors<br />
and shadows:<br />
CellBackColor (Long)<br />
background color of the table cell<br />
IsCellBackgroundTransparent (Boolean)<br />
sets the background color to transparent<br />
ShadowFormat (struct)<br />
specifies the shadow for cells (structure in accordance with com.sun.star.table.ShadowFormat)<br />
The com.sun.star.table.ShadowFormat structure and the detailed specifications for cell shadows have the<br />
following structure:<br />
Location (enum)<br />
position of shadow (value from the com.sun.star.table.ShadowLocation structure).<br />
ShadowWidth (Short)<br />
size of shadow in hundredths of a millimeter<br />
IsTransparent (Boolean)<br />
sets the shadow to transparent<br />
Color (Long)<br />
color of shadow<br />
The following example writes the number 1000 to the B2 cell, changes the background color to red using the<br />
CellBackColor property, and then creates a light gray shadow for the cell that is moved 1 mm to the left and<br />
down.<br />
Dim Doc As Object<br />
Dim Sheet As Object<br />
Dim Cell As Object<br />
Dim ShadowFormat As New com.sun.star.table.ShadowFormat<br />
Doc = ThisComponent<br />
Sheet = Doc.Sheets(0)<br />
Cell = Sheet.getCellByPosition(1,1)<br />
Cell.Value = 1000<br />
Cell.CellBackColor = RGB(255, 0, 0)<br />
ShadowFormat.Location = com.sun.star.table.ShadowLocation.BOTTOM_RIGHT<br />
ShadowFormat.ShadowWidth = 100<br />
ShadowFormat.Color = RGB(160, 160, 160)<br />
Cell.ShadowFormat = ShadowFormat<br />
Justification<br />
<strong>OpenOffice</strong>.<strong>org</strong> provides various functions that allow you to change the justification of a text in a table cell.<br />
The following properties define the horizontal and vertical justification of a text:<br />
Chapter 7 · Spreadsheet Documents 99