Hi Tobias,

I know how to check if a XTextRange is within a Cell of a text table. But
how do I evaluate if a
specific XTextRange CONTAINS a text table?

Any help is very appreciated!

the following basic macro checks the current selection in a writer document for TextTables ...

====================================

Sub Main
 Ranges = thiscomponent.currentcontroller.selection
 aRange = Ranges(0)     
 if containsTable(aRange) then
        msgbox "selected Range contains a TextTable"
 else
        msgbox "selected Range doesn't contain a TextTable"   
 endif  
End Sub

function containsTable(aRange) as Boolean
 ret = false
 aEnum = aRange.createEnumeration
 while aEnum.hasMoreElements
  aPortion = aEnum.nextElement
  if aPortion.supportsService("com.sun.star.text.TextTable") then
   ret=true
  endif
 wend
 containsTable=ret
end function

====================================

hope that helps

Regards

Stephan

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

Reply via email to