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 110<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<br />

For I = 0 To Rows.getCount() - 1<br />

Row = Rows.getByIndex(I)<br />

Row.BackColor = &HFF00FF<br />

Next<br />

The example first creates a list containing all rows using a Table.getRows call. The<br />

getCount and getByIndex methods allow the list to be further processed and belongs to the<br />

com.sun.star.table.XtableRows interface. The getByIndex method returns a row object,<br />

which supports the<br />

service.<br />

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

Here are the central methods of the<br />

com.sun.star.table.XtableRows<br />

interface:<br />

getByIndex(Integer)<br />

returns a row object for the specified index.<br />

getCount()<br />

returns the number of row objects.<br />

insertByIndex(Index, Count)<br />

inserts Count rows in the table as of the Index position.<br />

removeByIndex(Index, Count)<br />

deletes Count rows from the table as of the Index position.<br />

Whereas the getByIndex and getCount methods are available in all tables, the<br />

insertByIndex and removeByIndex methods can only be used in tables that do not contain<br />

merged cells.<br />

The<br />

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

service provides the following properties:<br />

BackColor (Long)<br />

background color of row.<br />

Height (Long)

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

Saved successfully!

Ooh no, something went wrong!