On OpenOffice documentation [1], I found a replace example. But I didn't find a search example.
Dim Doc As Object
Dim Sheet As Object
Dim ReplaceDescriptor As Object
Dim I As Integer
Doc = ThisComponent
Sheet = Doc.Sheets(0)
ReplaceDescriptor = Sheet.createReplaceDescriptor()
ReplaceDescriptor.SearchString = "is"
ReplaceDescriptor.ReplaceString = "was"
For I = 0 to Doc.Sheets.Count - 1
Sheet = Doc.Sheets(I)
Sheet.ReplaceAll(ReplaceDescriptor)
Next I
And better: Where can I find the docs that list the range/cell possible methods?
[1] http://wiki.openoffice.org/wiki/Documentation/BASIC_Guide/Editing_Spreadsheet_Documents
first of all: https://wiki.openoffice.org/wiki/Extensions_development_basic is a good starting point. In particular the XRAY tool is very helpfully.
The following code shows a search example:
Dim oDoc As Object
Dim oSheet As Object
Dim oSearchDescriptor As Object
Dim i As Integer
oDoc = ThisComponent
oSheet = oDoc.Sheets(0)
oSearchDescriptor = oSheet.createSearchDescriptor()
oSearchDescriptor.SearchString = "is"
For i = 0 to oDoc.Sheets.Count - 1
oSheet = oDoc.Sheets(i)
oResults = oSheet.findAll(oSearchDescriptor)
'xray oResults
if not isnull(oResults) then msgbox oResults.AbsoluteName
Next i
If you have XRAY installed, you can inspect every object with it and you have access to the related API docs.
Greetings
Axel