Basic Programmer's Guide > Introduction

StarOffice(tm) 7 Office Suite

Basic Programmer's Guide |

## Introduction

Previous · Start · Next

This guide provides an introduction to programming with StarOffice 7 Basic and indicates the possible applications provided by using StarOffice Basic in StarOffice. To get the most out of this book, you should be familiar with other programming languages.

Extensive examples are provided to help you quickly develop your own StarOffice Basic programs.

A number of migration tips for Microsoft Visual Basic programmers or those who have worked with earlier versions of StarOffice Basic are provided throughout the guide. These are indicated by a small symbol at the edge of the page. The Appendix of this guide contains an index of all of the migration tips so that you can quickly navigate to the tip that you want to read.

## About StarOffice Basic

The StarOffice Basic programming language has been developed especially for StarOffice and is firmly integrated in the Office package.

As the name suggests, StarOffice Basic is a programming language from the Basic family. Anyone who has previously worked with other Basic languages – in particular with Visual Basic or Visual Basic for Applications (VBA) from Microsoft – will quickly become accustomed to StarOffice Basic. Large sections of the basic constructs of StarOffice Basic are compatible with Visual Basic.

The StarOffice Basic programming language can be divided into four components:

- The language of StarOffice Basic: Defines the elementary linguistic constructs, for example, for variable declarations, loops, and functions.

- The runtime library: Provides standard functions which have no direct reference to StarOffice, for example, functions for editing numbers, strings, date values, and files.

- The StarOffice API (Application programming Interface): Permits access to StarOffice documents and allows these to be created, saved, modified, and printed.

- The Dialog Editor: Creates personal dialog windows and provides scope for the adding of control elements and event handlers.

Compatibility between StarOffice Basic and VBA relates to the StarOffice Basic language as well as the runtime library. The StarOffice API and the Dialog Editor are not compatible with VBA (standardizing these interfaces would have made many of the concepts provided in StarOffice impossible).

## Intended Users of StarOffice Basic

The scope of application for StarOffice Basic begins where the standard functions of StarOffice end. Routine tasks can therefore be automated in StarOffice Basic, links can be made to other programs – for example to a database server – and complex activities can be performed at the press of a button using predefined scripts.

StarOffice Basic offers complete access to all StarOffice functions, supports all functions, modifies document types, and provides options for creating personal dialog windows.

## Use of StarOffice Basic

StarOffice Basic can be used by any StarOffice user without any additional programs or aids.
Even in the standard installation, StarOffice Basic has all the components needed to create its own Basic macros, including:

- The integrated development environment (IDE) which provides an editor for creating and testing macros.

- The interpreter which is needed to run StarOffice Basic macros.

- The interfaces to various StarOffice applications, which allow for direct access to Office documents.

## Structure of This Guide

The first three chapters introduce readers to StarOffice Basic:

- Chapter 2: The Language of StarOffice Basic

- Chapter 3: The Runtime Library of StarOffice Basic

- Chapter 4: Introduction to the StarOffice API

These chapters provide an overview of StarOffice Basic and should be read by anyone who intends to write StarOffice Basic programs.

The remaining chapters describe the individual components of the StarOffice API in more detail and can be read selectively as required:

- Chapter 5: Working with StarOffice Documents

- Chapter 6: Text Documents

- Chapter 7: Spreadsheet Documents

- Chapter 8: Drawings and Presentations

- Chapter 9: Diagrams (Charts)

- Chapter 10: Database Access

- Chapter 11: Dialogs

- Chapter 12: Forms

## More Information

The components of the StarOffice API that are discussed in this guide were selected based on their practical benefits for the StarOffice Basic programmer. In general, only parts of the interfaces are discussed. For a more detailed picture, see the API reference which is available on the Internet at:

http://api.openoffice.org/common/ref/com/sun/star/module-ix.html

The Developer's Guide describes the StarOffice API in more detail than this guide, but is primarily intended for Java and C++ programmers. Anyone who is already familiar with StarOffice Basic programming can find additional information in the Developer's Guide on StarOffice Basic and StarOffice programming. You can download the Developer's Guide on the Internet from:

http://api.openoffice.org/DevelopersGuide/DevelopersGuide.html

Programmers who want to work directly with Java or C++ rather than StarOffice Basic should consult the StarOffice Developer's Guide instead of this guide. StarOffice programming with Java or C++ is a considerably more complex process than programming with StarOffice Basic.

© 2003 Sun Microsystems, Inc.