Page 1 of 1

Change FillColor TableShape

Posted: Wed Mar 29, 2017 9:15 pm
by kinnder
Hi!
I need help.
I use macro from book Andrew Pitonyak.

Code: Select all

Sub DrawTableShape
Dim oSize as New com.sun.star.awt.Size
Dim oPos as New com.sun.star.awt.Point
Dim oPage 
Dim oTable
Dim oCell 
Dim oDrawDoc ' Temporary draw document.
oDrawDoc = ThisComponent
' Set a size and table position.
oSize.Width = 6000 : oSize.Height = 6100
oPos.X = 6000 : oPos.Y = 5000
' Get the first draw page
oPage = oDrawDoc.DrawPages.getByIndex(0)
oTable = oDrawDoc.createInstance("com.sun.star.drawing.TableShape")
oPage.add(oTable)
oTable.Name="TEST3"
oTable.Model.Rows.InsertByIndex(1,4)
oTable.Model.Columns.InsertByIndex(1,4)
oTable.setSize(oSize)
oTable.setPosition(oPos)
oCell = oTable.Model.getCellByPosition(0,1)
oCell.getText().setString("X")

End Sub
How i can change color this table in macro? In document i can change color table manually.example table after use this macro in attachment.
I tried code,

Code: Select all

oStyle=oTable.Style
oStyle.FillColor=RGB(255,0,0)
but not work.

in the same time code

Code: Select all

oStyle.ShadowColor=RGB(255,0,0)
working

Thanks!

P.S. Sorry for my English.

Re: Change FillColor TableShape

Posted: Tue Apr 04, 2017 7:43 pm
by Zizi64
I suppose you want to change the bakground color of the CELLS:
viewtopic.php?f=10&t=23812

Code: Select all

oCell = oTModel.getCellByPosition(0,1)
oCell.FillColor =RGB(255,100,0)
Use one (or two nested) FOR cycle/s/ to fill all of the existing cells...


https://www.openoffice.org/api/docs/com ... html#SOLID