empy General User


Joined: 09 Mar 2004 Posts: 30 Location: Bavaria, Germany
|
Posted: Fri Apr 16, 2004 2:07 am Post subject: Working with Fonts within TextTable |
|
|
Played a bit with CharSet in a TextTable.
There are about 130 Properties you can set.
Hope I got the most important ones
| Code: |
Sub Main
' Define every Variable as the type expected by the Property
' CharHeight as float
Dim CharHeight As SINGLE
' BackColor as long
Dim CharBackColor As LONG
' CharColor as long
Dim CharColor As LONG
' CharFontName As String
Dim CharFontName As STRING
' CharShadow As Boolean
Dim CharShadow As BOOLEAN
' CharUnderlineColor As long
Dim CharUnderlineColor As LONG
' CharUnderline As int
Dim CharUnderline As INTEGER ' should be as short
' CharWeight as int
Dim CharWeight As INTEGER ' should be as short
' CharStrikeout As int
Dim CharStrikeout As INTEGER ' should be as short
' Couldn't get Italic Font working --> http://api.openoffice.org/docs/common/ref/com/sun/star/awt/FontSlant.html
' set the example variables
CharHeight = 9.0 ' Height of Font
CharBackColor = 2345667 ' Backgroundcolor of Font
CharColor = 3248903 ' FontColor
CharFontName = "Courier" ' Font Name
CharShadowed = true ' Font with Shadow
CharUnderline = 1 ' Font is underlined with single line
CharUnderlineColor = 2918503 ' Color of the Underline of Font
CharWeight = 150.000000 ' Font is BOLD
CharStrikeout = 2 ' Font is striked out with double line
' Access the first (0) table of Document
oTable = ThisComponent.TextTables(0)
'create a cursor on the cell
oCursor = oTable.createCursorByCellname("A1")
' Set all the defined Variables
With oCursor
'set the CharHeight
.CharHeight = CharHeight
'set the CharBackColor
.CharBackColor = CharBackColor
'set the CharColor
.CharColor = CharColor
'set the CharFontName
.CharFontName = CharFontName
'set the CharShadow
.CharShadowed = CharShadowed
'set the CharStrikeout
.CharStrikeout = CharStrikeout
'set the CharUnderline
.CharUnderline = CharUnderline
'set the CharUnderlineColor
.CharUnderlineColor = CharUnderlineColor
'set the CharWeight
.CharWeight = CharWeight
End With
end sub
|
Hope this will be useful for somebody
MP |
|