// The idea for this code came from:
// http://www.oooforum.org/forum/viewtopic.phtml?t=60451
XTextRange textRange = null;
XEnumerationAccess xParaAccess = (XEnumerationAccess) UnoRuntime.queryInterface(
XEnumerationAccess.class, table.getAnchor().getText());
XEnumeration xParaEnum = xParaAccess.createEnumeration();
while (retval == null && xParaEnum.hasMoreElements()){
Object elt = xParaEnum.nextElement();
XServiceInfo xInfo = (XServiceInfo) UnoRuntime.queryInterface(
XServiceInfo.class, elt);
if (xInfo.supportsService("com.sun.star.text.TextTable")) {