21.08.2013 Views

OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki

OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki

OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

More Than Just Text 111<br />

height of line in 100ths of a millimeter.<br />

IsAutoHeight (Boolean)<br />

table height is dynamically adapted to the content.<br />

VertOrient (const)<br />

vertical orientation of the text frame — details on vertical orientation of the text within<br />

the table (values in accordance with<br />

com.sun.star.text.VertOrientation<br />

)<br />

Columns<br />

Columns are accessed in the same way as rows, using the getByIndex, getCount,<br />

insertByIndex, and removeByIndex methods on the Column object, which is reached<br />

through getColumns. They can, however, only be used in tables that do not contain merged<br />

table cells. Cells cannot be formatted by column in <strong>OpenOffice</strong>.<strong>org</strong> Basic. To do so, the<br />

method of formatting individual table cells must be used.<br />

Cells<br />

Each cell of a <strong>OpenOffice</strong>.<strong>org</strong> document has a unique name. If the cursor of <strong>OpenOffice</strong>.<strong>org</strong><br />

is in a cell, then the name of that cell can be seen in the status bar. The top left cell is<br />

usually called A1 and the bottom right row is usually called Xn, where X stands for the<br />

letters of the top column and n for the numbers of the last row. The cell objects are<br />

available through the getCellByName() method of the table object. The following example<br />

shows a loop that passes through all the cells of a table and enters the corresponding row<br />

and column numbers into the cells.<br />

Dim Doc As Object<br />

Dim Table As Object<br />

Dim Cursor As Object<br />

Dim Rows As Object<br />

Dim RowIndex As Integer<br />

Dim Cols As Object<br />

Dim ColIndex As Integer<br />

Dim CellName As String<br />

Dim Cell As Object<br />

Doc = StarDesktop.CurrentComponent<br />

Cursor = Doc.Text.createTextCursor()<br />

Table = Doc.createInstance("com.sun.star.text.TextTable")<br />

Table.initialize(5, 4)<br />

Doc.Text.insertTextContent(Cursor, Table, False)<br />

Rows = Table.getRows

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!