Open talkingtoaj opened 1 year ago
From what I have been able to tell by pausing execution in the debugger, tables are not saved within paragraphs, but instead exist in document._body.tables
Tables are inserted via document._element._insert_tbl(tbl)
Existing tables can be inspected via [Table(tbl, self) for tbl in document._element.tbl_lst]
I believe paragraph spacing is possibly being lost because styles are not copying over.
The problem
We're using the python-docx package, which seems to be the best developed python package for ingesting and exporting docx files out there, but it is woefully lacking in some basics.
Currently our program will copy paragraphs and their formatting well, but the following are lost between being ingested from the template to the unique exams:
Desired solution
Some functions that will be called by
load_in_template()
andadd_paragraph()
which will ensure more of the Word elements are preserved.