Am Freitag, den 25.01.2008, 10:25 +0100 schrieb Boris Ratak:
> 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.
The bookmark itself has an interface "XContentEnumerationAccess". The example
in the IDL reference looks like this:
Example
This example prints the names of all tables:
xTextTableEnum = xTextDoc.createContentEnumeration(
"com::sun::star::text::TextTable" )
while xTextTableEnum.hasMoreElements() do
print xTextTableEnum.nextElement().Name
wend
So, by swapping the xTextDoc from the example with your bookmark that
should be what you need.
Hmm, but that doesn't work, at least not in OO.o 1.1.3 ... but look,
this way it does:
' 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()
while xTextEnum.hasMoreElements()
el = xTextTableEnum.nextElement()
if el.SupportsService( "com.sun.star.text.TextTable" ) then
print el.Name
endif
wend
Have fun,
Marc
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]