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.

The Structure of Spreadsheets 125<br />

Dim Sheet As Object<br />

Doc = StarDesktop.CurrentComponent<br />

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

If Doc.Sheets.hasByName("MySheet") Then<br />

Sheet = Doc.Sheets.getByName("MySheet")<br />

Else<br />

Sheet = Doc.createInstance("com.sun.star.sheet.Spreadsheet")<br />

Doc.Sheets.insertByName("MySheet", Sheet)<br />

End If<br />

The getByName and insertByName methods are from the<br />

com.sun.star.container.XnameContainer<br />

interface as described in → Introduction to the API.<br />

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

<strong>Guide</strong>/ Structure_ of_ Spreadsheets&oldid=96877<br />

Principal Authors: Fpe, Ccornell, Sheanhoxie<br />

Rows and Columns<br />

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

and Columns properties of the spreadsheet object and support the<br />

and/or<br />

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

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

services.<br />

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

of a sheet and stores 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 = StarDesktop.CurrentComponent<br />

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

FirstCol = Sheet.Columns(0)

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

Saved successfully!

Ooh no, something went wrong!