3

我在Libre/OpenOffice Base表格中有動態填充的表格控件。
我想改變它的高度以匹配行數。
如何做到這一點?OpenOffice基地 - 如何改變表格控制宏的高度?

我試圖改變getSize()/setSize()height財產,但我發現:

Property or method not found: getSize 

我的代碼:

oTable = oForm.GetByName("MySubForm").GetByName("MyTable") 
oTable.getSize() 

可視化: http://i.imgur.com/IHi75.png

關於此表控制,因爲它在基地命名 - 在調試器它是com.star.comp.forms.OGridControlModel,在con tent.xml它被列爲com.sun.star.form.component.GridControl

回答

1

你的問題是表對象沒有高度,高度是基於行數(以及TopMargin和BottomMargin)。

每一行都有它自己的Height屬性。

如果你想要一個表的高度,你需要總結所有行的高度。表中有TopMargin和BottomMargin屬性會影響?感知?身高也是如此。

Rows = Table.getRows 
For I = 0 To Rows.getCount() - 1 
    Row = Rows.getByIndex(I) 
    CurrentHeight = CurrentHeight + Row.Height 
Next 

如果你想設置您需要可以添加/刪除行或更改當前行的高度表格的高度。

Rows.insertByIndex(Rows.getCount(), 1) 
Row = Rows.getByIndex(Rows.getCount() - 1) 
Row.IsAutoHeight = False 
Row.Height = 1000 

你可以看一下完整的在線文檔。 http://wiki.services.openoffice.org/wiki/Documentation/BASIC_Guide/More_Than_Text

+0

表控制它不是通常的作家表。我可以修改'Table.RowHeight'來一次改變所有的行,但它不會改變表的高度,只是行下的空白。 「Table」或「Table.RowSet」中沒有'Top/BottomMargin'屬性。請參閱:http://i.imgur.com/IHi75.png - 隨時可以填寫 –

+1

@Jacek_FH - 您可以使用鼠標手動更改桌面高度嗎?如果可以的話,必須有一些我們錯過的財產,如果你不能這樣做,宏觀語言也許是不可能的。或者也許你可以改變表格周圍的子表格的高度。 –

+0

我不能用我的鼠標(在視圖中)改變它。我看過content.xml - 高度不是'' - >''的屬性,但是'' - >'svg:height' –