Hi Boris,
Boris Ratak escribió:
Hi,
I'm searching for a way to interact with a table located in a bookmark
in a Writer document (using an OOBasic macro). I know how to get the
bookmark, but I can't see a getTextTable (or something similar) method
in the bookmark ou anchor object. Does anyone know how to do it? It
would be really helpful to me.
If you read
http://api.openoffice.org/docs/DevelopersGuide/Text/Text.xhtml#1_3_1_1_2_Text_Contents_Other_Than_Strings
you'll see that
"A text content is an object that is attached to a
com.sun.star.text.XTextRange. The text range it is attached to is called
the anchor of the text content."
...
"The method getAnchor() at the XTextContent interface returns a text
range which reflects the text position where the object is located. This
method may return a void object, for example, for text frames that are
bound to a page. The method getAnchor() is used in situations where an
XTextRange is required. For instance, placeholder fields
(com.sun.star.text.textfield.JumpEdit) can be filled out using their
getAnchor() method. Also, yo can get a bookmark, retrieve its XTextRange
from getAnchor() and use it to insert a string at the bookmark position."
As I see your mails ends with .fr I'm sure you already now well
http://fr.openoffice.org/Documentation/How-to/Basic/OOo_API_intro-07.sxw
there (6.8.e Ecrire du texte dans une cellule de tableau) Bernard
teaches you that:
Si vous avez défini un signet dans une cellule d’un tableau, vous devez
récupérer l’objet cellule ainsi :
Dim MonDocument As Object, Mazone As Object
Dim CurseurDansCellule As Object, UneCellule As Object
MonDocument = ThisComponent
Mazone = MonDocument.Bookmarks("signet3").getAnchor
UneCellule = Mazone.Cell
CurseurDansCellule = UneCellule.createTextCursorByRange(Mazone)
UneCellule.insertString(CurseurDansCellule, " formidable !", false)
Sure you also know
http://fr.openoffice.org/Documentation/How-to/Basic/XrayTool_fr.sxw
If you Xray MonDocument.Bookmarks("signet3").getAnchor() you will see
that you can get also the TextTable
UneCellule = Mazone.Cell
UneTableau = Mazone.TextTable
of course, before using them, check if they are not null nor empty.
Hope that helps.
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]