Iterating Impress table contents in Python with XEnumerationAccess.createEnumeration throws RuntimeException

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Iterating Impress table contents in Python with XEnumerationAccess.createEnumeration throws RuntimeException

Shri Borde-2
I am using the Python code below to walk all the shapes in a slide. The
slide just has one table. The call to createEnumeration fails with:

com.sun.star.uno.RuntimeException: illegal object given!

I am using OpenOffice 3.2 on Linux. How can I walk all the cells of a table?

  def WalkShape(self, shape):
    if uno.getTypeByName(XEnumerationAccess.__pyunointerface__) in
shape.getTypes():
      for inner_shape in shape.createEnumeration():
        self.WalkShape(inner_shape)
    else:
      print shape

  def WalkPage(self, page):
    for idx in xrange(page.Count):
      shape = page.getByIndex(idx)
      self.WalkShape(shape)