21.08.2013 Views

OpenOffice.org BASIC Guide - OpenOffice.org wiki

OpenOffice.org BASIC Guide - OpenOffice.org wiki

OpenOffice.org BASIC Guide - 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.

The same interface provides methods moveByName and copyByName.<br />

The Structure of Spreadsheets<br />

The com.sun.star.container.XNameContainer interface provides a method to remove a sheet of a given name:<br />

Dim Doc As Object<br />

Doc = ThisComponent<br />

Doc.Sheets.removeByName("OtherSheet")<br />

Rows and Columns<br />

Each sheet contains a list of its rows and columns. These are available through the Rows and Columns properties<br />

of the spreadsheet object and support the com.sun.star.table.TableColumns and/or com.sun.star.table.TableRows<br />

services.<br />

The following example creates two objects that reference the first row and the first column of a sheet and stores<br />

the references in the FirstCol and FirstRow object variables.<br />

Dim Doc As Object<br />

Dim Sheet As Object<br />

Dim FirstRow As Object<br />

Dim FirstCol As Object<br />

Doc = ThisComponent<br />

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

FirstCol = Sheet.Columns(0)<br />

FirstRow = Sheet.Rows(0)<br />

The column objects support the com.sun.star.table.TableColumn service that has the following properties:<br />

Width (long)<br />

width of a column in hundredths of a millimeter.<br />

OptimalWidth (Boolean)<br />

sets a column to its optimum width.<br />

IsVisible (Boolean)<br />

displays a column.<br />

IsStartOfNewPage (Boolean)<br />

when printing, creates a page break before a column.<br />

The width of a column is only optimized when the OptimalWidth property is set to True. If the width of an<br />

individual cell is changed, the width of the column that contains the cell is not changed. In terms of functionality,<br />

OptimalWidth is more of a method than a property.<br />

The row objects are based on the com.sun.star.table.TableRow service that has the following properties:<br />

Height (long)<br />

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

OptimalHeight (Boolean)<br />

sets the row to its optimum height.<br />

IsVisible (Boolean)<br />

displays the row.<br />

IsStartOfNewPage (Boolean)<br />

when printing, creates a page break before the row.<br />

If the OptimalHeight property of a row is set to the True, the row height changes automatically when the<br />

height of a cell in the row is changed. Automatic optimization continues until the row is assigned an absolute<br />

height through the Height property.<br />

Chapter 7 · Spreadsheet Documents 93

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

Saved successfully!

Ooh no, something went wrong!