It worked ! I've tried Marc's solution and it worked like a charm. Again, the 
bookmark is AROUND the table, not inside a table cell.

Just in case someone with the same problem comes by later, I post the full 
script with the init of the variables (and a little typo in the original script 
at the nextElement line) :

oDoc = thiscomponent 'current document
oBookmark = thiscomponent.Bookmarks.getByName("bookmark_ex") 'change 
"bookmark_ex" with your bookmark's name

' create a cursor at the bookmark
csr = oDoc.Text.createTextCursor()
csr.gotoRange(oBookmark.getAnchor(), FALSE)

' iterate over the content spanned by the bookmark
xTextEnum = csr.createEnumeration()
Do while xTextEnum.hasMoreElements()
    el = xTextEnum.nextElement()
    if el.SupportsService( "com.sun.star.text.TextTable" ) then
         print el.Name
         print el.getCellByName("A1").string
         exit do 'we'll work only on the first table
    endif
Loop

Thank you Marc, Ariel and Cor, you helped me a lot :)


----- Message d'origine ----
De : Ariel Constenla-Haile <[EMAIL PROTECTED]>
À : [email protected]
Envoyé le : Samedi, 26 Janvier 2008, 0h12mn 11s
Objet : Re: [api-dev] Getting tables in Bookmark (OOBasic)

Hi Marc,

Marc Santhoff escribió:
> Am Freitag, den 25.01.2008, 19:31 -0300 schrieb Ariel
 Constenla-Haile:
>> Hi Marc,
>>
>>
>> Marc Santhoff escribió:
>>> [...]
>> Boris is trying to access a bookmark inserted inside a TextTable's
>> cell (if I understood well)
>>
>>> ' create a cursor at the bookmark
>>> csr = oDoc.Text.createTextCursor()
>>> csr.gotoRange(oBookmark.getAnchor(), FALSE)
>> this won't work, 
> ...
> 
> It does, it's tested.

well, that's a little trick you've done ;-)

> As long as the bookmark spans over the complete table 

in this case, the bookmark is NOT inside a (table's) cell, and "spans 
over the complete table" means the bookmarks starts at least one 
paragraph over the table and finish one paragraph behind the table...

> (which is how I did it), 

but Boris (if I understood) is trying to access a bookmark inside a 
(table's) cell, am I wrong Boris?

> there is no problem. If the table is after or below the
> bookmark another, similar strategy will do.

This is also questionable. If the bookmark is only above or below the 
table without spanning, you have no way to create a text cursor at the 
bookmark anchor and then send it inside a cell's text, because text 
objects are different. In this case a view cursor will work (if the 
bookmark is above the table move it down one line, etc...)

Regards
Ariel.


-- 
Ariel Constenla-Haile
La Plata, Argentina

[EMAIL PROTECTED]
[EMAIL PROTECTED]

http://www.ArielConstenlaHaile.com.ar/ooo/



"Aus der Kriegsschule des Lebens
             - Was mich nicht umbringt,
    macht mich härter."
             Nietzsche Götzendämmerung, Sprüche und Pfeile, 8.

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







      
_____________________________________________________________________________ 
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 
http://mail.yahoo.fr

Reply via email to