JeJe wrote:try running this - make sure your table is on screen.
Thank you,
JeJe and
Villeroy for the code suggestions. I ended up with this Python snippet:
Code: Select all
def print_accessible_context(ac):
nonlocal indent
print(indent, "name", ac.AccessibleName, "role", ac.AccessibleRole, "children", ac.AccessibleChildCount)
if ac.AccessibleRole == 58:
print(indent, " rows", ac.AccessibleRowCount, "cols", ac.AccessibleColumnCount)
for row in range(ac.AccessibleRowCount):
for col in range(ac.AccessibleColumnCount):
print(indent, " cell at", row, col, "rowspan", ac.getAccessibleRowExtentAt(row, col), "colspan", ac.getAccessibleColumnExtentAt(row, col))
indent += " "
for i in range(ac.AccessibleChildCount):
print_accessible_context(ac.getAccessibleChild(i).AccessibleContext)
indent = indent[1:]
indent = ""
# controller is a com.sun.star.frame.XController
print_accessible_context(controller.Frame.ComponentWindow.AccessibleContext)
Which returns for the first table in the initial post
Code: Select all
name Table1-1 role 58 children 4
rows 2 cols 3
cell at 0 0 rowspan 1 colspan 3
cell at 0 1 rowspan 1 colspan 2
cell at 0 2 rowspan 1 colspan 1
cell at 1 0 rowspan 1 colspan 1
cell at 1 1 rowspan 1 colspan 1
cell at 1 2 rowspan 1 colspan 1
role 59 children 1
role 41 children 0
role 59 children 1
role 41 children 0
role 59 children 1
role 41 children 0
role 59 children 1
role 41 children 0
Merged cells are listed, too, which is alright, I guess. However, I run office in headless and invisible mode and perhaps that’s why not all tables in my document appear in the accessible context dump. The other problem I haven’t figured out yet is how to connect a table and its accessible context (the
AccessibleName (Table1-1) seems to be a variation of the actual object’s name (Table1)).
Perhaps it’s time to take a look at the
HTML export filter for some help…
Mac 10.14 using LO 7.2.0.2, Gentoo Linux using LO 7.2.3.2 headless.