Well, consider this macro which sets all instances starting from the
first table to bold. I did not attempt to see if the cursor had left the
table for this macro.
Sub SearchTable
Dim oDescriptor, oFound
Dim oTable
Dim oCell
REM Get the FIRST text table
oTable = ThisComponent.getTextTables().getByIndex(0)
oCell = oTable.getCellByName("A1")
'Inspect(oTable)
'Exit Sub
oDescriptor = ThisComponent.createSearchDescriptor()
With oDescriptor
.SearchString = "one"
.SearchWords = False
.SearchCaseSensitive = False
End With
REM oFound = ThisComponent.findFirst(oDescriptor)
oFound = ThisComponent.findNext( oCell.getText().getStart(), oDescriptor)
Do While Not IsNull(oFound)
oFound.CharWeight = com.sun.star.awt.FontWeight.BOLD
oFound = ThisComponent.findNext( oFound.End, oDescriptor)
Loop
End Sub
I will create a new section in my macro document and demonstrate a
complete working example that searches ONLY the first text table.
This will be titled " Search only the first text table". I will finish
this and post it before I go to sleep tonight.
Kent Gibson wrote:
odd, I tried everything I could to tell the search
where to begin. I am happy to use macros to get this
working. Do you have an example? I want to tell the
search to begin at an arbitrary table, first cell is
perfectly ok for me.
--- Andrew Douglas Pitonyak <[EMAIL PROTECTED]>
wrote:
If you are using a macro to search, you can indicate
where a search will
begin. For example, you can specify that the search
should start at the
first position of the text object in the first cell
of a table. Or, you
could start searching from the last point before the
text table begins.
You can then check the end position to see if it is
after the text table
of interest. There are, of course, certain
difficulties when comparing
ranges that are NOT in the same text object, but
that is related to the
details of solving the problem, rather than
answering your high-level
question.
--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
My Book: http://www.hentzenwerke.com/catalog/oome.htm
Info: http://www.pitonyak.org/oo.php
See Also: http://documentation.openoffice.org/HOW_TO/index.html
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]