SACGF / SACGF/variantgrid

Case report Word generation: monospaced Results Summary and DRAFT banner

Open
#1,874 0 comments 0 reactions 1 assignee Claimed by @davmlaw View on GitHub
Dominant language
Python
Stars
30
Forks
3
Avg merge
9h 22m
Merged PRs (30d)
40

Description

🤖 Written by Claude.

The Word file is derived from the same HTML as the PDF, so this issue owns only what **html2docx does to
it** — the content itself is #1873. Nothing automated can see any of this: the tests
assert on the docx XML, not on what Word draws.

Download via `/classification/case_report//download/docx`. **Open in real Word, not LibreOffice** —
font substitution is half of what's being tested.

Test against the **SA Path TSO 500 template** (`sapath/data/reports/tso500_case_report.html`, loaded by
sapath migration `0014_tso500_report_template`) — it is the only user of multi-variant reporting, and the
only template with a `

` block.

## Results Summary monospacing

A `

` reaches Word with its spaces and line breaks intact but in the body's proportional font, so a

column-aligned Results Summary lines up nowhere. `` is the one tag html2docx takes a font from, and
`render_docx` opens one at each `
` and rewrites html2docx's "Mono" (not a font Word has) to Courier New.

- [ ] The Results Summary block is **Courier New, 10pt** in Word.
- [ ] Its columns actually line up — Tier / Gene / Protein / VAF under their headings.
- [ ] **The block is not one long line.** This is the fragile one: the `` has to stay open to the
`

`, because closing it drops the run html2docx turns the block's newlines into Word breaks on,
and the whole Results Summary arrives on a single line.
- [ ] Body text either side of the block is unchanged — still proportional, not Courier.
- [ ] The `
` stays a `
`: we deliberately did **not** switch it to a real table, because the PDF

is read side by side with the legacy document.

## DRAFT banner

The Word file's answer to the PDF's watermark — the rotated, positioned div has no Word equivalent, so it
is stripped and a banner paragraph added instead.

- [ ] A draft's DOCX opens with **"DRAFT - not the issued report"** as the first paragraph: bold, red,
14pt.
- [ ] The word "DRAFT" from the HTML watermark div does **not** also appear as stray text anywhere.
- [ ] After finalise, the DOCX has **no** banner (download again after finalising).
- [ ] Rebuild on a still-draft report keeps the banner.

## Regressions to re-check

- [ ] `` and `<script>` contents still do not print as the Word file's first paragraph — html2docx
has no notion of a document head and this has bitten before.
- [ ] Headings, tables and the tier sections survive the round trip as they did before this change — the
renderer now goes through python-docx to post-process, where it used to return html2docx's bytes
directly, so the whole document is worth a skim.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.