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

Create successful ePaper yourself

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

7<br />

C H A P T E R 7<br />

7 Spreadsheet Documents<br />

<strong>OpenOffice</strong>.<strong>org</strong> Basic provides an extensive interface for program-controlled creation and editing of<br />

spreadsheets. This chapter describes how to control the relevant services, methods and properties of spreadsheet<br />

documents:<br />

The Structure of Spreadsheets<br />

Editing Spreadsheet Documents<br />

The first section addresses the basic structure of spreadsheet documents and shows you how to access and to edit<br />

the contents of individual cells.<br />

The second section concentrates on how to edit spreadsheets efficiently by focusing on cell areas and the options<br />

for searching and replacing cell contents.<br />

Note – StarOffice 5 : The Range object allows you to address any table area and has been extended in the new<br />

API.<br />

The Structure of Spreadsheets<br />

The document object of a spreadsheet is based on the com.sun.star.sheet.SpreadsheetDocument service. Each of<br />

these documents may contain several spreadsheets. In this guide, a table-based document or spreadsheet<br />

document is the entire document, whereas a spreadsheet (or sheet for short) is a sheet (table) in the document.<br />

Note – VBA : Different terminology for spreadsheets and their content is used in VBA and <strong>OpenOffice</strong>.<strong>org</strong><br />

Basic. Whereas the document object in VBA is called a Workbook and its individual pages Worksheets, they are<br />

called SpreadsheetDocument and Sheet in <strong>OpenOffice</strong>.<strong>org</strong> Basic.<br />

Spreadsheets<br />

You can access the individual sheets of a spreadsheet document through the Sheets list.<br />

The following examples show you how to access a sheet either through its number or its name.<br />

Example 1: access by means of the number (numbering begins with 0)<br />

Dim Doc As Object<br />

Dim Sheet As Object<br />

Doc = ThisComponent<br />

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

91

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

Saved successfully!

Ooh no, something went wrong!