Skip to content

v0.6.2

Choose a tag to compare

@ferdinandobons ferdinandobons released this 09 Jun 07:41
· 50 commits to main since this release

A robustness fix for real-world templates. No schema, profile or output change for well-formed templates; profiles from earlier versions keep working unchanged.

Fixed

  • DOCX extract and generate no longer crash on templates whose section measures are non-integer twips (e.g. 1440.0000000000002 in w:pgMar / w:pgSz, emitted by some editors). python-docx parses measures with int() and raises the moment any code touches the value, including its own internals (Document.add_table derives the table width from section.left_margin). The shell's section measures are now sanitized in place (sub-twip rounding, page geometry visually identical) and every section-length read tolerates the malformed value via a raw-twips fallback.

Tests

  • MalformedSectionMeasureTest: the section-length helpers tolerate the bad value, sanitize_section_measures repairs it in place, and a generate with a table block (the exact crash path) survives a malformed margin.