Fix duplicate pgMar causing line numbering issue
Mirror and run GitLab CI / build (push) Has been cancelled
Ruff / ruff (push) Has been cancelled

- Update existing pgMar instead of appending a second one
- Prevents Word from miscounting lines on first page
This commit is contained in:
admin
2026-06-16 18:03:39 +00:00
parent c43076efd4
commit 0e6bc53cf8
+4 -2
View File
@@ -322,7 +322,10 @@ def _create_transcript_section_properties(section):
sectPr = section._sectPr
# Margins: 1 inch = 1440 twips
pgMar = sectPr.find(f"{{{W_NS}}}pgMar") or OxmlElement("w:pgMar")
pgMar = sectPr.find(f"{{{W_NS}}}pgMar")
if pgMar is None:
pgMar = OxmlElement("w:pgMar")
sectPr.append(pgMar)
_set_element_attr(pgMar, "top", "1440")
_set_element_attr(pgMar, "right", "1440")
_set_element_attr(pgMar, "bottom", "1440")
@@ -330,7 +333,6 @@ def _create_transcript_section_properties(section):
_set_element_attr(pgMar, "header", "720")
_set_element_attr(pgMar, "footer", "720")
_set_element_attr(pgMar, "gutter", "0")
sectPr.append(pgMar)
# Disable document grid to avoid Word counting phantom grid lines
docGrid = sectPr.find(f"{{{W_NS}}}docGrid")