I'm trying to create a table that looks like this, using the python-docx module.
Working from the example code for creating a table in example-makedocument.py and reading through the code in docx.py, I thought something similar to this would work:
tbl_rows = [ ['A1'],
['B1', 'B2' ],
['C1', 'C2' ] ]
tbl_colw = [ [100],
[25, 75],
[25, 75] ]
tbl_cwunit = 'pct'
body.append(table(tbl_rows, colw=tbl_colw, cwunit=tbl_cwunit))
however this corrupts the docx document, and when Word recovers the document the table is shown as this:
How can I get a row to properly span multiple columns using python-docx?


TableCellaGridSpaninstance. EDIT: looking at the source code, it doesn't seem like you can do this with python-docx.