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.

Editing Spreadsheet Documents<br />

EDITATTR<br />

character formatting that only applies to parts of the cells<br />

You can also add the constants together to delete different information using a call from clearContents.<br />

Searching and Replacing Cell Contents<br />

Spreadsheet documents, like text documents, provide a function for searching and replacing.<br />

The descriptor objects for searching and replacing in spreadsheet documents are not created directly through the<br />

document object, but rather through the Sheets list. The following is an example of a search and replace process:<br />

Dim Doc As Object<br />

Dim Sheet As Object<br />

Dim ReplaceDescriptor As Object<br />

Dim I As Integer<br />

Doc = ThisComponent<br />

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

ReplaceDescriptor = Sheet.createReplaceDescriptor()<br />

ReplaceDescriptor.SearchString = "is"<br />

ReplaceDescriptor.ReplaceString = "was"<br />

For I = 0 to Doc.Sheets.Count - 1<br />

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

Sheet.ReplaceAll(ReplaceDescriptor)<br />

Next I<br />

This example uses the first page of the document to create a ReplaceDescriptor and then applies this to all<br />

pages in a loop.<br />

110 <strong>OpenOffice</strong>.<strong>org</strong> 3.2 <strong>BASIC</strong> <strong>Guide</strong> · March 2010

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

Saved successfully!

Ooh no, something went wrong!