Merge pull request 'fix(export): תיקוני-תבנית DOCX — חתימות לסוף, א–ד ללא נתונים, "החלטה"=כותרת (#205)' (#355) from worktree-agent-a4e6a6d273c4c3379 into main
This commit was merged in pull request #355.
This commit is contained in:
@@ -182,16 +182,21 @@ def _add_runs_with_inline_bold(paragraph: Paragraph, text: str) -> None:
|
||||
|
||||
|
||||
def _clear_body(doc: DocumentT) -> None:
|
||||
"""Remove every paragraph currently in the document body.
|
||||
"""Remove ALL body content (paragraphs, tables, stray bookmarks),
|
||||
keeping only sectPr.
|
||||
|
||||
The template ships with example paragraphs ("רקע", "דיון והכרעה"…)
|
||||
that we don't want in the output. Section properties (sectPr) are
|
||||
kept so page size / margins / RTL / footer remain intact.
|
||||
The template ships with example paragraphs ("רקע", "דיון והכרעה"…) *and
|
||||
three sample tables* (header / panel / signatures). Removing only ``w:p``
|
||||
left the tables behind — including the signatures table, which then floated
|
||||
to the top against the header table. Mirror the decision exporter's
|
||||
``_clear_body`` (G2 symmetry): drop everything except sectPr, which carries
|
||||
page setup including bidi.
|
||||
"""
|
||||
body = doc.element.body
|
||||
for p in list(body.findall(qn("w:p"))):
|
||||
body.remove(p)
|
||||
# Leave sectPr alone — it carries page setup including bidi.
|
||||
sectPr_tag = qn("w:sectPr")
|
||||
for child in list(body):
|
||||
if child.tag != sectPr_tag:
|
||||
body.remove(child)
|
||||
|
||||
|
||||
def _add_paragraph(doc: DocumentT, text: str, style: str) -> Paragraph:
|
||||
|
||||
Reference in New Issue
Block a user