I've got Table Control in Libre/OpenOffice Base form which is filled dynamically.
I want to change height of it to match number of rows.
How to do it?
I've tried changing getSize() / setSize(), and height property but I'm getting:
Property or method not found: getSize
My code:
oTable = oForm.GetByName("MySubForm").GetByName("MyTable")
oTable.getSize()
Visualisation: https://i.sstatic.net/socUI.png
About this Table Control as it is named in Base - in debugger it's com.star.comp.forms.OGridControlModel, in content.xml it's listed as com.sun.star.form.component.GridControl
Your problem is the Table object has no height, the height is based on the number of rows (as well as the TopMargin and BottomMargin).
Every row has it's own Height property.
If you want a Table's height you need to sum the Height of all of the rows. Tables have TopMargin and BottomMargin properties that effect ?perceived? height as well.
Rows = Table.getRows
For I = 0 To Rows.getCount() - 1
Row = Rows.getByIndex(I)
CurrentHeight = CurrentHeight + Row.Height
Next
If you want to set a Table's height you need to either add/remove rows or change the Height of the current rows.
Rows.insertByIndex(Rows.getCount(), 1)
Row = Rows.getByIndex(Rows.getCount() - 1)
Row.IsAutoHeight = False
Row.Height = 1000
You can look at the full documentation online. http://wiki.services.openoffice.org/wiki/Documentation/BASIC_Guide/More_Than_Text
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With