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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Rows and Columns 127<br />

Doc = StarDesktop.CurrentComponent<br />

Sheet = Doc.Sheets(0)<br />

For I = 0 To 4<br />

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

Row.OptimalHeight = True<br />

Next I<br />

Col = Sheet.Columns(1)<br />

Col.IsVisible = False<br />

The Rows and Columns lists can be accessed through an index in <strong>OpenOffice</strong>.<strong>org</strong> Basic. Unlike in VBA,<br />

the first column has the index 0 and not the index 1.<br />

Inserting and Deleting Rows and Columns<br />

The Rows and Columns objects of a sheet can access existing rows and columns as well as<br />

insert and delete them.<br />

Dim Doc As Object<br />

Dim Sheet As Object<br />

Dim NewColumn As Object<br />

Doc = StarDesktop.CurrentComponent<br />

Sheet = Doc.Sheets(0)<br />

Sheet.Columns.insertByIndex(3, 1)<br />

Sheet.Columns.removeByIndex(5, 1)<br />

This example uses the insertByIndex method to insert a new column into the fourth column<br />

position in the sheet (index 3 - numbering starts at 0). The second parameter specifies the<br />

number of columns to be inserted (in this example: one).<br />

The removeByIndex method deletes the sixth column (index 5). Again, the second<br />

parameter specifies the number of columns that you want to delete.<br />

The methods for inserting and deleting rows use the Rows object function in the same way<br />

as the methods shown for editing columns using the Columns object.<br />

Source: http:/ / <strong>wiki</strong>. services. openoffice. <strong>org</strong>/ w/ index. php? title=Documentation/ <strong>BASIC</strong>_<br />

<strong>Guide</strong>/ Rows_ and_ Columns&oldid=96878<br />

Principal Authors: Fpe, Ccornell

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

Saved successfully!

Ooh no, something went wrong!