Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenOffice Base - how to change height of Table Control in Macro?

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

like image 345
Jacek Kaniuk Avatar asked Dec 06 '25 20:12

Jacek Kaniuk


1 Answers

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

like image 190
Louis Ricci Avatar answered Dec 10 '25 11:12

Louis Ricci



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!