diff --git a/scraibe/email_sender.py b/scraibe/email_sender.py index 6596dfe..7ea7910 100644 --- a/scraibe/email_sender.py +++ b/scraibe/email_sender.py @@ -327,9 +327,15 @@ def _configure_section_margins(doc, margin=1.0): def _enable_line_numbering(section, start_at=1, count_by=1, restart=True): """ Enable line numbering for a specific section. + Disables the document grid so Word counts lines based on content, not grid lines. """ sectPr = section._sectPr + # Disable document grid to avoid Word treating a grid line as line 1 + docGrid = sectPr.find(qn("w:docGrid")) + if docGrid is not None: + docGrid.set(qn("w:type"), "none") + # Create the line numbering element: lnNumType = OxmlElement("w:lnNumType") lnNumType.set(qn("w:start"), str(start_at))