我已经以动态填充的Libre / OpenOffice Base形式获得了表控件。
我想更改其高度以匹配行数。
怎么做?
我已经尝试更改getSize()
/ setSize()
和height
属性,但是我得到了:
Property or method not found: getSize
我的代码:
oTable = oForm.GetByName("MySubForm").GetByName("MyTable")
oTable.getSize()
可视化:
http://i.imgur.com/IHi75.png
关于在Base中命名的表控件-在调试器中为
com.star.comp.forms.OGridControlModel
,在content.xml中为 com.sun.star.form.component.GridControl
列出
最佳答案
您的问题是Table对象没有高度,该高度基于行数(以及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
关于openoffice.org - OpenOffice Base-如何在宏中更改表格控件的高度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8485486/