I have an issue with odfpy and Python 3. I try to copy an existing table in an Opendocument Text file. I'm failing at getting the style information out of the original table. Here is my code:
# templateTable is a table.Table that has to be copied
for childNode in templateTable.childNodes:
if 'style-name' in str(childNode.attributes):
# the next command fails and the python interpreter tells me
# 'style-name' is not in list
style = childNode.getAttribute('style-name')
Help is welcome!
I had to figure out what you actually did. Anyone else trying to figure out what OP did, basically remove the dashes/hyphens from the attribute names. So in this case,
style-name
becomesstylename
. So if you havedraw:style-name
attribute, just pass in it asstylename
instead ofstyle-name