You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Inkspan Office currently renders DOCX headings, paragraphs, rich runs, lists, tables, informative PNG figures, hyperlinks, and page breaks, but the request contract deliberately exposes no page size, orientation, or margins. Business reports, proposals, handoffs, and print-ready documents therefore inherit the library template's implicit page setup rather than carrying an explicit deterministic layout contract.
This is a bounded next-release slice. The protected 0.6.0 source candidate must remain unchanged until its release/registry acceptance is complete; implementation may proceed on a Draft branch but must not merge into protected main before the 0.6.0 release boundary is resolved.
ECMA-376 / Office Open XML WordprocessingML section properties (w:sectPr, page size and page margins) remain the normative OOXML representation; repository doctoring must cite the current official ECMA publication in APA 7 style.
When present, require one exact complete object rather than merging ambiguous partial defaults:
paper_size: a4 or letter;
orientation: portrait or landscape;
margins_mm: object containing integer top, right, bottom, and left.
Bound every margin to 0–100 mm. Booleans, floats, strings, nulls, aliases, case variants, missing edges, and unknown fields fail closed.
Map A4 to exact 210 × 297 mm and US Letter to exact 8.5 × 11 in dimensions. Landscape swaps physical width/height and sets the Word orientation property; do not guess from width alone.
Apply layout only to the document's existing single default section. Do not add multi-section authoring, headers/footers, gutter, columns, binding, mirrored margins, page numbers, or arbitrary page dimensions in this slice.
Omitted page_layout preserves the current template/default behavior exactly.
Add schema tests, runtime round-trip tests through python-docx, fail-closed invalid-input tests, deterministic-output and no-partial-publication tests.
Keep production statement/branch coverage and public docstring coverage at 100% on Python 3.11–3.14.
Add Office buyer documentation, an ADR, standards/APA-7 doctoring, traceability, and CHANGELOG only when the branch can do so without racing the active canonical documentation writer. If documentation paths are still leased elsewhere, runtime/test work must remain path-disjoint and documentation reconciliation must wait rather than creating competing authority.
Non-goals
No arbitrary OOXML or raw section XML.
No printer selection or PDF service.
No CSS-to-Word page-layout translation.
No multiple sections or mixed portrait/landscape pages.
No network, filesystem input, credentials, model calls, persistence, tenant, or host authorization authority.
Test-first acceptance
RED from the exact protected source generation: a permanent schema/runtime test proves page_layout is currently rejected as an unknown DOCX field.
GREEN only after the narrow public schema and renderer apply exact bounded section settings and the focused/full Office suites pass.
Buyer-visible document-fidelity gap
Inkspan Office currently renders DOCX headings, paragraphs, rich runs, lists, tables, informative PNG figures, hyperlinks, and page breaks, but the request contract deliberately exposes no page size, orientation, or margins. Business reports, proposals, handoffs, and print-ready documents therefore inherit the library template's implicit page setup rather than carrying an explicit deterministic layout contract.
This is a bounded next-release slice. The protected 0.6.0 source candidate must remain unchanged until its release/registry acceptance is complete; implementation may proceed on a Draft branch but must not merge into protected
mainbefore the 0.6.0 release boundary is resolved.Primary technical basis
python-docx1.2.0 official section documentation: https://python-docx.readthedocs.io/en/latest/user/sections.html — a Word section owns page dimensions, orientation, and margins; changing to landscape requires the corresponding page dimensions.python-docx1.2.0 section API: https://python-docx.readthedocs.io/en/stable/api/section.html —orientation,page_width,page_height, and edge-margin properties are read/write section properties.w:sectPr, page size and page margins) remain the normative OOXML representation; repository doctoring must cite the current official ECMA publication in APA 7 style.Required contract
page_layout; XLSX/PPTX contracts remain unchanged.paper_size:a4orletter;orientation:portraitorlandscape;margins_mm: object containing integertop,right,bottom, andleft.page_layoutpreserves the current template/default behavior exactly.python-docx, fail-closed invalid-input tests, deterministic-output and no-partial-publication tests.Non-goals
Test-first acceptance
page_layoutis currently rejected as an unknown DOCX field.