OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Working with Fonts within TextTable

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Code Snippets
View previous topic :: View next topic  
Author Message
empy
General User
General User


Joined: 09 Mar 2004
Posts: 30
Location: Bavaria, Germany

PostPosted: Fri Apr 16, 2004 2:07 am    Post subject: Working with Fonts within TextTable Reply with quote

Played a bit with CharSet in a TextTable.
There are about 130 Properties you can set.
Hope I got the most important ones Smile

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
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Code Snippets All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group