List Info

Thread: Styling cells in a spreadsheet in Basic




Styling cells in a spreadsheet in Basic
user name
2007-10-23 10:50:10
Hi I want to know how to style cells in a spreadsheet,
things like  
background color, border and width.

I am not sure if this is the best list to ask OOoBasic
questions but there  
it goes. If there is a better list for this, please let me
know.

-- 
Alexandro Colorado
CoLeader of OpenOffice.org ES
http://es.openoffice.org


------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


Re: Styling cells in a spreadsheet in Basic
user name
2007-10-23 11:14:45
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Alexandro

REM  *****  BASIC  *****

OPTION EXPLICIT

Sub Main
	Dim oDoc as Object
	Dim oCell as Object
	Dim oRange as Object
	Dim oStyles as Object
		
	oDoc = ThisComponent

	'direct (hard) cell formating ...	
	oCell =
oDoc.getSheets().getByIndex(0).getCellByPosition(0,0)
	oCell.CellBackColor = 256

	'direct range formating ...	
	oRange =
oDoc.getSheets().getByIndex(0).getCellRangeByPosition(2,2,4,
4)
	oRange.CellBackColor = 128
	
	' soft format via a cell style
	oStyles =
oDoc.StyleFamilies.getByName("CellStyles")
	' change color of build in cell style "Result"
        oStyles.getByName("Result").CellBackColor
= 192
	
	' apply to a range ...
	oRange =
oDoc.getSheets().getByIndex(0).getCellRangeByPosition(2,6,4,
8)
	oRange.CellStyle = "Result"

End Sub

Oliver

Am 23.10.2007 17:50 schrieb Alexandro Colorado:
> Hi I want to know how to style cells in a spreadsheet,
things like
> background color, border and width.
> 
> I am not sure if this is the best list to ask OOoBasic
questions but
> there it goes. If there is a better list for this,
please let me know.
> 


- --

GnuPG key 0xCFD04A45: 8822 057F 4956 46D3 352C 1A06 4E2C
AB40 CFD0 4A45
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


iD8DBQFHHh31TiyrQM/QSkURArOdAJ0bgbsdZGNh3MBpJwRowAVDQSkGKQCf
Xg8b
vyhxJyPIP2TOUSP4nX3cyvA=
=dYkK
-----END PGP SIGNATURE-----

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )