I think that you set borders either using a Style (just a guess, never
have done it, but it would imply that the style itself specifies the
border), or by manipulating a cell (or probably a cell range, I am guess
rather than grabbing a copy of my book). I know that I do cover this in
my book, and maybe in my free macro document. I do have this bit of code
sitting around (and I see that it uses a table, oops)
Dim v
Dim x
v = oTable.TableBorder
x = v.TopLine
x.OuterLineWidth = 2
v.TopLine = x
x = v.LeftLine
x.OuterLineWidth = 2
v.LeftLine = x
x = v.RightLine
x.OuterLineWidth = 2
v.RightLine = x
x = v.TopLine
x.OuterLineWidth = 2
v.TopLine = x
x = v.VerticalLine
x.OuterLineWidth = 2
v.VerticalLine = x
x = v.HorizontalLine
x.OuterLineWidth = 0
v.HorizontalLine = x
x = v.BottomLine
x.OuterLineWidth = 2
v.BottomLine = x
'v.Distance = 51
oTable.TableBorder = v
This just gives you a hint at how to do what you want, since it likely
does not do what you want.
Notice that I do "stupid" things like this...
x = v.BottomLine
x.OuterLineWidth = 2
v.BottomLine = x
This is because the following will fail:
v.BottomLine.OuterLineWidth = 2
This fails because v.BottomLine returns a copy of the structure, rather
than a reference to the structure. so, what the working code does, is to
create and modify a copy, then assign it back. So, why does assigning it
back work rather than just assign it to a copy? Well, you ask too many
question :-) or, it is because it is internally treated as a set (I did
not check the real reason).
Alexandro Colorado wrote:
thanks oliver however I dont see how to get the borders and width
since is not color based is nowhere to be found near that IDL. The
only border I found was for table which I am not sure is the same as
the spreadsheet borders.
On Tue, 23 Oct 2007 11:14:45 -0500, Oliver Brinzing
<[EMAIL PROTECTED]> wrote:
-----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/QSkURArOdAJ0bgbsdZGNh3MBpJwRowAVDQSkGKQCfXg8b
vyhxJyPIP2TOUSP4nX3cyvA=
=dYkK
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
My Book: http://www.hentzenwerke.com/catalog/oome.htm
Info: http://www.pitonyak.org/oo.php
See Also: http://documentation.openoffice.org/HOW_TO/index.html
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]