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

How 2 change background color & other properties of cell

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
pep
Guest





PostPosted: Fri May 23, 2003 2:23 am    Post subject: How 2 change background color & other properties of cell Reply with quote

Hello,
next code fill background of actual range with Red color...

but, what i must change if i want fill a given range, for example A1:A10, and not the actual selected range

thanks and bye!
pep


Code:

dim document, dispatcher as object

document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")


dim args2(4) as new com.sun.star.beans.PropertyValue
args2(0).Name = "BackgroundPattern.Transparent"
args2(0).Value = false
args2(1).Name = "BackgroundPattern.BackColor"
args2(1).Value = 16724787
args2(2).Name = "BackgroundPattern.URL"
args2(2).Value = ""
args2(3).Name = "BackgroundPattern.Filtername"
args2(3).Value = ""
args2(4).Name = "BackgroundPattern.Position"
args2(4).Value = com.sun.star.style.GraphicLocation.NONE


dispatcher.executeDispatch(document, ".uno:BackgroundPattern", "", 0, args2())
Back to top
uros
Super User
Super User


Joined: 22 May 2003
Posts: 601
Location: Slovenia

PostPosted: Fri May 23, 2003 3:46 am    Post subject: Reply with quote

Hello pep!

Try this code:

Dim oDocument As Object
Dim sOptions As String
Dim oSheets As Object
Dim oSheet As Object
Dim oRange As Object

oDocument = ThisComponent
oSheets = oDocument.Sheets
oSheet = oSheets.getByName("Sheet1")
oRange = oSheet.getCellRangeByPosition(0,0,0,9)
oRange.CellBackColor = 1234567
rem 0 - black, ..., white = 16.777.215

rem 'paint cell B1 from toolbar to get the code for implemented color
oCell = oSheet.getCellByPosition(1,0)
MsgBox ("Color of B1 is " & oCell.CellBackColor)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API 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