Re: [api-dev] Searching Tables or Cell Ranges in the Writer

2006-07-18 Thread Andrew Douglas Pitonyak
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]



Re: [api-dev] Searching Tables or Cell Ranges in the Writer

2006-07-16 Thread Andrew Douglas Pitonyak
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.


Kent Gibson wrote:


Thanks for the suggestion. Something like that might
work. Perhaps I should explain the problem a bit more.
I am having some quirky problems inserting images into
tables. So I thought I would render my table and
instead of inserting images, I would insert some text
(ie a url) then when I finished the table I would
replace the text with an image (with a macro). The
idea works great. But search only seems to work at the
document level. The idea won't work at the very end of
rendering, becuase I need to render the table (which
is in a frame) and then replace the images and then
check to see how big my frame is, because these frames
will be chained. 


I could render a table, do my search and throw out
previosly found tables (this may be computationally
very expensive at the end of a large document). Or
render my table, and do a forward search. But I am not
sure if either of these will work.


--- Peter Eberlein
[EMAIL PROTECTED] wrote:

 


Hi Kent,

Kent Gibson schrieb:
   


Is there any way to do a search using XSearchable
 


in
   


writer and set the scope to something other than
 


the
   


document, for example a table or a cell range?

I am pretty sure it works in calc with cell
 


ranges,
   


but I can't get it work in the writer for anything
 


but
   


a document.

 


why not checking the found-objects (which are
XTextRanges), if they 
support one of the XTextTable-Services?


Peter


   


-
 


To unsubscribe, e-mail:
[EMAIL PROTECTED]
For additional commands, e-mail:
[EMAIL PROTECTED]


   




__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

 



--
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]



Re: [api-dev] Searching Tables or Cell Ranges in the Writer

2006-07-12 Thread Peter Eberlein

Hi Kent,

Kent Gibson schrieb:

Is there any way to do a search using XSearchable in
writer and set the scope to something other than the
document, for example a table or a cell range?

I am pretty sure it works in calc with cell ranges,
but I can't get it work in the writer for anything but
a document.



why not checking the found-objects (which are XTextRanges), if they 
support one of the XTextTable-Services?


Peter

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] Searching Tables or Cell Ranges in the Writer

2006-07-12 Thread Kent Gibson
Thanks for the suggestion. Something like that might
work. Perhaps I should explain the problem a bit more.
I am having some quirky problems inserting images into
tables. So I thought I would render my table and
instead of inserting images, I would insert some text
(ie a url) then when I finished the table I would
replace the text with an image (with a macro). The
idea works great. But search only seems to work at the
document level. The idea won't work at the very end of
rendering, becuase I need to render the table (which
is in a frame) and then replace the images and then
check to see how big my frame is, because these frames
will be chained. 

I could render a table, do my search and throw out
previosly found tables (this may be computationally
very expensive at the end of a large document). Or
render my table, and do a forward search. But I am not
sure if either of these will work.


--- Peter Eberlein
[EMAIL PROTECTED] wrote:

 Hi Kent,
 
 Kent Gibson schrieb:
  Is there any way to do a search using XSearchable
 in
  writer and set the scope to something other than
 the
  document, for example a table or a cell range?
  
  I am pretty sure it works in calc with cell
 ranges,
  but I can't get it work in the writer for anything
 but
  a document.
 
 
 why not checking the found-objects (which are
 XTextRanges), if they 
 support one of the XTextTable-Services?
 
 Peter
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 
 


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]