scitex_msword.tables

Table insertion utilities for python-docx Documents.

The public entry point insert_table_after_paragraph() builds a <w:tbl> element directly with pure lxml (so it works on raw python-docx 1.1.x without going through the high-level Table API) and inserts it as the next sibling of a target paragraph. When the source document already has Track Changes enabled, each generated <w:tr> is marked as an inserted row by emitting <w:trPr><w:ins .../></w:trPr> so that Word surfaces the new rows as accept/reject-able revisions — matching the dogfood-time pattern proj-grant’s build_v43.py shipped in BOOST today.

OOXML refs:

  • w:tbl ECMA-376 §17.4.38

  • w:tblPr ECMA-376 §17.4.59

  • w:tblGrid ECMA-376 §17.4.49

  • w:tr ECMA-376 §17.4.79

  • w:trPr ECMA-376 §17.4.82

  • w:ins (in trPr) ECMA-376 §17.13.5.18 (row-level insertion marker)

Functions

insert_table_after_paragraph(doc, ...[, ...])

Insert a Word table immediately after doc.paragraphs[paragraph_index].